當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Bar::getAll方法代碼示例

本文整理匯總了PHP中Bar::getAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Bar::getAll方法的具體用法?PHP Bar::getAll怎麽用?PHP Bar::getAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Bar的用法示例。


在下文中一共展示了Bar::getAll方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

    $mail->isHTML(true);
    $mail->Subject = 'Somebody sent you a token!';
    $mail->Body = 'HEY YOU GUYS!  LOOK WAT I DONE DID!!!!!!.';
    $mail->AltBody = 'Received token.';
    $email = $_POST['email'];
    $name = $_POST['name'];
    if (!$mail->send()) {
        $message = 'Message could not be sent. <p>';
    } else {
        $message = 'Message has been sent.';
    }
    return $app['twig']->render("email.html.twig", array('message' => $message));
});
$app->post("/add_preferred_bar/{id}", function ($id) use($app) {
    $user = Patron::find($id);
    $all_bars = Bar::getAll();
    $bar = Bar::find($_POST['add_bar']);
    $user->addPreferredBar($bar);
    return $app['twig']->render("patron.html.twig", array('user' => $user, 'user_tokens' => $user->getTokens(), 'all_bars' => $all_bars, 'preferred_bars' => true, 'send_token' => false, 'token_form' => false, 'edit_user' => false));
});
// $app->delete("/delete_preferred_bar/{id}/{bar_id}", function($id, $bar_id) use($app) {
//     $user = Patron::find($id);
//     $all_bars = Bar::getAll();
//     $bar = Bar::find($bar_id);
//     $user->deleteBar($bar);
//     return $app['twig']->render("patron.html.twig", array(
//         'user' => $user,
//         'user_tokens' =>$user->getTokens(),
//         'all_bars' => $all_bars,
//         'preferred_bars' => false,
//         'send_token' => false,
開發者ID:CaseyH33,項目名稱:Beer_Me,代碼行數:31,代碼來源:app.php

示例2: testDelete

 function testDelete()
 {
     $name = "Side Street";
     $phone = "555-555-5555";
     $address = "123 ABC. Street";
     $website = "http://www.sidestreetpdx.com";
     $test_bar = new Bar($name, $phone, $address, $website);
     $test_bar->save();
     $name2 = "ABC Pub";
     $phone2 = "444-444-4444";
     $address2 = "321 CBA Street";
     $website2 = "http://www.sesamestreet.com";
     $test_bar2 = new Bar($name2, $phone2, $address2, $website2);
     $test_bar2->save();
     $test_bar->delete();
     $result = Bar::getAll();
     $this->assertEquals([$test_bar2], $result);
 }
開發者ID:kellimargaret,項目名稱:Beer-Me,代碼行數:18,代碼來源:BarTest.php

示例3: search

 static function search($search_name)
 {
     $found_bar = NULL;
     $bars = Bar::getAll();
     foreach ($bars as $bar) {
         $name = $bar->getName();
         if ($name == $search_name) {
             $found_bar = $bar;
         }
     }
     return $found_bar;
 }
開發者ID:kellimargaret,項目名稱:Beer-Me,代碼行數:12,代碼來源:Bar.php

示例4: find

 static function find($search_id)
 {
     $found_bar = null;
     $all_bars = Bar::getAll();
     foreach ($all_bars as $bar) {
         if ($bar->getId() == $search_id) {
             $found_bar = $bar;
         }
     }
     return $found_bar;
 }
開發者ID:CaseyH33,項目名稱:Beer_Me,代碼行數:11,代碼來源:Bar.php


注:本文中的Bar::getAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。