本文整理匯總了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]);
}