本文整理汇总了PHP中Client::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::getAll方法的具体用法?PHP Client::getAll怎么用?PHP Client::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client::getAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display()
{
$allClients = Client::getAll();
$upcomingTasks = Task::getRecent();
$pastDue = Task::pastDue();
return View::make('clients_page')->with('allClients', $allClients)->with('pastDue', $pastDue)->with('upcomingTasks', $upcomingTasks);
}
示例2: delete
function delete()
{
$clients = Client::getAll();
foreach ($clients as $client) {
if ($client->getStylistId() == $this->getId()) {
$client->delete();
}
}
$GLOBALS['DB']->exec("DELETE FROM stylists WHERE id = {$this->getId()};");
}
示例3: find
static function find($search_id)
{
$found_client = null;
$all_clients = Client::getAll();
foreach ($all_clients as $client) {
if ($client->getId() == $search_id) {
$found_client = $client;
}
}
return $found_client;
}
示例4: find
static function find($search_id)
{
$found_client = null;
$clients = Client::getAll();
foreach ($clients as $client) {
$client_id = $client->getId();
if ($client_id == $search_id) {
$found_client = $client;
}
//end of if
}
//end of foreach
return $found_client;
}
示例5: test_getAll
function test_getAll()
{
//Arrange
$client_name = "Ted";
$stylist_id = 1;
$test_client = new Client($client_name, $stylist_id);
$test_client->save();
$client_name2 = "Mae";
$stylist_id2 = 2;
$test_client2 = new Client($client_name2, $stylist_id2);
$test_client2->save();
//Act
$result = Client::getAll();
//Assert
$this->assertEquals([$test_client, $test_client2], $result);
}
示例6: testDelete
function testDelete()
{
//Arrange
$name = "Jackie";
$test_stylist = new Stylist($name);
$test_stylist->save();
$name = "Sandra Jane";
$phone = "542-334-0984";
$style_choice = "The Rachel";
$stylist_id = $test_stylist->getId();
$test_client = new Client($name, $phone, $style_choice, $stylist_id);
$test_client->save();
$name2 = "Jordy Duran";
$phone2 = "239-094-0281";
$style_choice2 = "Bowl Cut";
$test_client2 = new Client($name2, $phone2, $style_choice2, $stylist_id);
$test_client2->save();
//Act
$test_client->delete();
//Assert
$this->assertEquals([$test_client2], Client::getAll());
}
示例7: test_delete
function test_delete()
{
//Arrange
$stylist_name = "bob";
$id = null;
$test_stylist = new Stylist($stylist_name, $id);
$test_stylist->save();
$client_name = "joe";
$stylist_id = $test_stylist->getId();
$test_client = new Client($client_name, $id, $stylist_id);
$test_client->save();
$client_name2 = "jerry";
$test_client2 = new Client($client_name2, $id, $stylist_id);
$test_client2->save();
//Act
$test_client->delete();
//Assert
$this->assertEquals([$test_client2], Client::getAll());
}
示例8: testDelete
function testDelete()
{
//Arrange
$id = null;
$name = "Martha Stewart";
$phone = "(888) 888-8888";
$next_visit = "2015-09-06";
$stylist_id = 1;
$test_client = new Client($id, $name, $phone, $next_visit, $stylist_id);
$test_client->save();
$name2 = "Jennifer Lopez";
$phone2 = "(609) 999-9999";
$next_visit2 = "2015-10-12";
$stylist_id2 = 2;
$test_client2 = new Client($id, $name2, $phone2, $next_visit2, $stylist_id2);
$test_client2->save();
//Act
$test_client->delete();
//Assert
$result = Client::getAll();
$this->assertEquals([$test_client2], $result);
}
示例9: testDeleteStylistClients
function testDeleteStylistClients()
{
//Arrange
$stylist_name = "Bob";
$id = null;
$test_stylist = new Stylist($stylist_name, $id);
$test_stylist->save();
$client_name = "Joe";
$stylist_id = $test_stylist->getId();
$test_client = new Client($client_name, $id, $stylist_id);
$test_client->save();
//Act
$test_stylist->delete();
//Assert
$this->assertEquals([], Client::getAll());
}
示例10: test_client_delete
function test_client_delete()
{
//Arrange
$name = "Vidal Sassoon";
$test_stylist = new Stylist($name);
$test_stylist->save();
$name2 = "Sweeney Todd";
$test_stylist2 = new Stylist($name2);
$test_stylist2->save();
$name3 = "Mr. T";
$stylist_id = $test_stylist->getId();
$test_client = new Client($name3, $stylist_id, null);
$test_client->save();
$name4 = "Mrs. T";
$stylist_id2 = $test_stylist2->getId();
$test_client2 = new Client($name4, $stylist_id2, null);
$test_client2->save();
//Act
$test_client->delete();
//Assert
$this->assertEquals([$test_client2], Client::getAll());
}
示例11: array
$client->save();
$stylist = Stylist::find($stylist_id);
return $app['twig']->render('stylist.html.twig', array('stylist' => $stylist, 'client' => $stylist->getClient()));
});
$app->post("/stylists", function () use($app) {
$stylist = new Stylist($_POST['name']);
$stylist->save();
return $app['twig']->render('index.html.twig', array('stylists' => Stylist::getAll()));
});
$app->post("/delete_stylists", function () use($app) {
//Clients::deleteAll();
Stylist::deleteAll();
return $app['twig']->render('index.html.twig', array('stylists' => Stylist::getAll()));
});
$app->post("/delete_client", function () use($app) {
$category_id = $_POST['stylist_id'];
Client::delete($stylist_id);
return $app['twig']->render('index.html.twig', array('stylists' => Stylist::getAll()));
});
$app->get("/all_clients", function () use($app) {
return $app['twig']->render('all_clients.html.twig', array('clients' => Client::getAll(), 'stylists' => Stylist::getAll()));
});
$app->post("/client", function () use($app) {
$name = $_POST['name'];
$stylist_id = $_POST['stylist_id'];
$client = new Client($name, $stylist_id);
$client->save();
$stylist = Stylist::find($stylist_id);
return $app['twig']->render('stylist.html.twig', array('stylist' => $stylist, 'clients' => Client::getAll()));
});
return $app;
示例12: testDeleteStylistClients
function testDeleteStylistClients()
{
//Arrange
$name = "Erin";
$id = null;
$test_stylist = new Stylist($name, $id);
$test_stylist->save();
$name = "George";
$id = null;
$test_client = new Client($name, $stylist_id);
$test_client->save();
//Act
$test_stylist->delete();
//Assert
$this->assertEquals([], Client::getAll());
}
示例13: test_deleteAll
function test_deleteAll()
{
//Arrange
$name = "Barbra Stylist";
$id = null;
$test_stylist = new Stylist($name, $id);
$test_stylist->save();
$name = "George";
$id = null;
$stylist_id = $test_stylist->getId();
$test_Client = new Client($name, $stylist_id, $id, $visits, $description);
$test_Client->save();
$name2 = "Max";
$id2 = null;
$stylist_id2 = $test_stylist->getId();
$visits2 = 3;
$test_Client2 = new Client($name2, $stylist_id2, $id2, $visits2, $description);
$test_Client2->save();
//Act
Client::deleteAll();
//Assert
$result = Client::getAll();
$this->assertEquals([], $result);
}
示例14: array
$escaped_array = array();
foreach ($input_associative_array as $key => $value) {
$escaped_array[$key] = preg_quote($value, "'");
}
return $escaped_array;
}
//////////////////////////// Routes
// Landing page. [R]ead
$app->get("/", function () use($app) {
return $app['twig']->render('index.html.twig', array('stylists' => Stylist::getAll()));
});
// [D]elete all stylists and clients
$app->delete("/", function () use($app) {
Stylist::deleteAll();
Client::deleteAll();
return $app['twig']->render('index.html.twig', array('clients' => Client::getAll()));
});
// [C]reate Stylist, display all stylists
$app->post("/stylists", function () use($app) {
$escaped_inputs = escapeCharsInArray($_POST);
$new_stylist = new Stylist($escaped_inputs['name'], $escaped_inputs['phone'], $escaped_inputs['specialty'], $escaped_inputs['weekends']);
$new_stylist->save();
return $app['twig']->render('index.html.twig', array('stylists' => Stylist::getAll()));
});
// [R]ead one particular Stylist
$app->get("/stylists/{id}", function ($id) use($app) {
$stylist = Stylist::find($id);
return $app['twig']->render('stylist.html.twig', array('stylist' => $stylist, 'clients' => $stylist->getClients()));
});
// [U]pdate a particular Stylist
$app->patch("/stylists/{id}", function ($id) use($app) {
示例15: testDelete
function testDelete()
{
//Arrange
$id = null;
$client_name = "Nico";
$stylist_id = 1;
$test_client = new Client($id, $client_name, $stylist_id);
$test_client->save();
$client_name2 = "Al";
$stylist_id2 = 2;
$test_client2 = new Client($id, $client_name2, $stylist_id2);
$test_client2->save();
//Act
$test_client->delete();
//Assert
$result = Client::getAll();
$this->assertEquals([$test_client2], $result);
}