当前位置: 首页>>代码示例>>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;未经允许,请勿转载。