本文整理匯總了PHP中Model\User::getAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::getAll方法的具體用法?PHP User::getAll怎麽用?PHP User::getAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Model\User
的用法示例。
在下文中一共展示了User::getAll方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: function
});
$server->register('moveTaskPosition', function ($project_id, $task_id, $column_id, $position) use($task) {
return $task->movePosition($project_id, $task_id, $column_id, $position);
});
/**
* User procedures
*/
$server->register('createUser', function (array $values) use($user) {
list($valid, ) = $user->validateCreation($values);
return $valid && $user->create($values);
});
$server->register('getUser', function ($user_id) use($user) {
return $user->getById($user_id);
});
$server->register('getAllUsers', function () use($user) {
return $user->getAll();
});
$server->register('updateUser', function ($values) use($user) {
list($valid, ) = $user->validateModification($values);
return $valid && $user->update($values);
});
$server->register('removeUser', function ($user_id) use($user) {
return $user->remove($user_id);
});
/**
* Category procedures
*/
$server->register('createCategory', function ($project_id, $name) use($category) {
$values = array('project_id' => $project_id, 'name' => $name);
list($valid, ) = $category->validateCreation($values);
return $valid && $category->create($values);
示例2: testGetAll
public function testGetAll()
{
$u = new User($this->container);
$this->assertEquals(2, $u->create(array('username' => 'you')));
$this->assertEquals(3, $u->create(array('username' => 'me', 'name' => 'Me')));
$users = $u->getAll();
$this->assertCount(3, $users);
$this->assertEquals('admin', $users[0]['username']);
$this->assertEquals('me', $users[1]['username']);
$this->assertEquals('you', $users[2]['username']);
}