当前位置: 首页>>代码示例>>PHP>>正文


PHP Bar::save方法代码示例

本文整理汇总了PHP中Bar::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Bar::save方法的具体用法?PHP Bar::save怎么用?PHP Bar::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bar的用法示例。


在下文中一共展示了Bar::save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: function

});
//Sign Up Routes:
$app->get("/show_customer_signup", function () use($app) {
    return $app['twig']->render('index.html.twig', array('about' => false, 'sign_up' => true, "sign_in" => false, 'team' => false, 'customer_signup' => true, 'business_signup' => false));
});
$app->get("/show_business_signup", function () use($app) {
    return $app['twig']->render('index.html.twig', array('about' => false, 'sign_up' => true, "sign_in" => false, 'team' => false, 'customer_signup' => false, 'business_signup' => true));
});
$app->post("/customer_signup", function () use($app) {
    $new_user = new Patron($_POST['username'], $_POST['email']);
    $new_user->save();
    return $app['twig']->render("signup_confirmation.html.twig");
});
$app->post("/business_signup", function () use($app) {
    $new_bar = new Bar($_POST['name'], $_POST['phone'], $_POST['address'], $_POST['website']);
    $new_bar->save();
    return $app['twig']->render("signup_confirmation.html.twig");
});
//Get Show email search
$app->get("/show_email_search/{id}", function ($id) use($app) {
    $user = Patron::find($id);
    $all_bars = Bar::getAll();
    return $app['twig']->render("patron.html.twig", array('user' => $user, 'user_tokens' => $user->getTokens(), 'all_bars' => $all_bars, 'preferred_bars' => false, 'send_token' => true, 'token_form' => false, 'edit_user' => false));
});
//Get Show User Tokens
$app->get("/show_user_tokens/{id}", function ($id) use($app) {
    $user = Patron::find($id);
    $tokens = $user->getTokens();
    return $app['twig']->render("patron.html.twig", array('user' => $user, 'user_tokens' => $tokens, 'preferred_bars' => false, 'send_token' => false, 'token_form' => true, 'edit_user' => false));
});
//Get Show User edit
开发者ID:kellimargaret,项目名称:Beer-Me,代码行数:31,代码来源:app.php

示例2: testAssociateBelongsTo

 public function testAssociateBelongsTo()
 {
     $thing = $this->testInsert(false);
     $bar = new Bar();
     $bar->bar_name = "sammy";
     $bar->associateWith($thing);
     $bar->save();
     $t = new Thing($thing->id);
     $t->retrieve(array('with' => 'bar'));
     $this->assertEquals($bar->bar_name, $t->bar->bar_name);
     $this->assertEquals($bar->thing_id, $t->bar->thing_id);
 }
开发者ID:seansitter,项目名称:picnicphp,代码行数:12,代码来源:Pfw_Model_Test.php

示例3: testGetAllTokens

 function testGetAllTokens()
 {
     $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();
     $test_item = new Item("tacos", 2.25);
     $test_item->save();
     $test_bar->addItem($test_item);
     $returned_ids = $GLOBALS['DB']->query("SELECT id FROM menus WHERE bar_id = {$test_bar->getId()};");
     $ids = array();
     foreach ($returned_ids as $returned_id) {
         $id = $returned_id['id'];
         array_push($ids, $id);
     }
     $name = "Kyle Pratuch";
     $email = "kyle.pratuch@gmail.com";
     $test_patron = new Patron($name, $email);
     $test_patron->save();
     $test_token = new Token($test_patron->getId(), $ids[0], 3);
     $test_token->save();
     //   var_dump($test_token);
     $result = $test_bar->getAllTokens();
     $this->assertEquals($test_token, $result[0]);
 }
开发者ID:kellimargaret,项目名称:Beer-Me,代码行数:27,代码来源:BarTest.php

示例4: testGetPreferredBars

 function testGetPreferredBars()
 {
     //Arrange
     $name = "Kyle Pratuch";
     $email = "kyle.pratuch@gmail.com";
     $test_patron = new Patron($name, $email);
     $test_patron->save();
     $bar_name = "Side Street";
     $phone = "555-555-5555";
     $address = "123 ABC. Street";
     $website = "http://www.sidestreetpdx.com";
     $test_bar = new Bar($bar_name, $phone, $address, $website);
     $test_bar->save();
     $bar_name2 = "ABC Pub";
     $phone2 = "444-444-4444";
     $address2 = "321 CBA Street";
     $website2 = "http://www.sesamestreet.com";
     $test_bar2 = new Bar($bar_name2, $phone2, $address2, $website2);
     $test_bar2->save();
     $test_patron->addPreferredBar($test_bar);
     $test_patron->addPreferredBar($test_bar2);
     //Act
     $result = $test_patron->getPreferredBars();
     //Assert
     $this->assertEquals([$test_bar, $test_bar2], $result);
 }
开发者ID:CaseyH33,项目名称:Beer_Me,代码行数:26,代码来源:PatronTest.php


注:本文中的Bar::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。