本文整理汇总了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,
示例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);
}
示例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;
}
示例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;
}