本文整理汇总了PHP中UserRepository::GetAll方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRepository::GetAll方法的具体用法?PHP UserRepository::GetAll怎么用?PHP UserRepository::GetAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserRepository
的用法示例。
在下文中一共展示了UserRepository::GetAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ProcessDataRequest
public function ProcessDataRequest($dataRequest)
{
if ($dataRequest == 'permissions') {
$this->page->SetJsonResponse($this->GetUserResourcePermissions());
} elseif ($dataRequest == 'groups') {
$this->page->SetJsonResponse($this->GetUserGroups());
} elseif ($dataRequest == 'all') {
$users = $this->userRepository->GetAll();
$this->page->SetJsonResponse($users);
}
}
示例2: testGetAllUsersReturnsAllActiveUsers
public function testGetAllUsersReturnsAllActiveUsers()
{
$timezone = 'UTC';
$language = 'en_us';
$preferences = 'n1=v1';
$userRows = array(array(ColumnNames::USER_ID => 1, ColumnNames::FIRST_NAME => "f1", ColumnNames::LAST_NAME => 'l1', ColumnNames::EMAIL => 'e1', ColumnNames::TIMEZONE_NAME => $timezone, ColumnNames::LANGUAGE_CODE => $language), array(ColumnNames::USER_ID => 2, ColumnNames::FIRST_NAME => "f2", ColumnNames::LAST_NAME => 'l2', ColumnNames::EMAIL => 'e2', ColumnNames::TIMEZONE_NAME => $timezone, ColumnNames::LANGUAGE_CODE => $language, ColumnNames::USER_PREFERENCES => $preferences), array(ColumnNames::USER_ID => 3, ColumnNames::FIRST_NAME => "f3", ColumnNames::LAST_NAME => 'l3', ColumnNames::EMAIL => 'e3', ColumnNames::TIMEZONE_NAME => $timezone, ColumnNames::LANGUAGE_CODE => $language));
$this->db->SetRows($userRows);
$userRepository = new UserRepository();
$users = $userRepository->GetAll();
$user1 = new UserDto(1, "f1", "l1", "e1", $timezone, $language);
$user2 = new UserDto(2, "f2", "l2", "e2", $timezone, $language, $preferences);
$user3 = new UserDto(3, "f3", "l3", "e3", $timezone, $language);
$getAllUsersCommand = new GetAllUsersByStatusCommand(AccountStatus::ACTIVE);
$this->assertEquals($user1, $users[0]);
$this->assertEquals($user2, $users[1]);
$this->assertEquals($user3, $users[2]);
$this->assertEquals(1, count($this->db->_Commands));
$this->assertEquals($getAllUsersCommand, $this->db->_Commands[0]);
}