本文整理汇总了PHP中Role::getOneFromDb方法的典型用法代码示例。如果您正苦于以下问题:PHP Role::getOneFromDb方法的具体用法?PHP Role::getOneFromDb怎么用?PHP Role::getOneFromDb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Role
的用法示例。
在下文中一共展示了Role::getOneFromDb方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetRoleActionTargets
public function testGetRoleActionTargets()
{
$r = Role::getOneFromDb(['role_id' => 3], $this->DB);
$ats = $r->getRoleActionTargets();
$this->assertEqual(9, count($ats));
$this->assertEqual(207, $ats[0]->role_action_target_link_id);
$this->assertEqual(210, $ats[1]->role_action_target_link_id);
$this->assertEqual(212, $ats[2]->role_action_target_link_id);
$this->assertEqual(220, $ats[3]->role_action_target_link_id);
$this->assertEqual(221, $ats[4]->role_action_target_link_id);
$this->assertEqual(37, $ats[5]->role_action_target_link_id);
$this->assertEqual(38, $ats[6]->role_action_target_link_id);
$this->assertEqual(39, $ats[7]->role_action_target_link_id);
$this->assertEqual(40, $ats[8]->role_action_target_link_id);
}
示例2: loadRole
public function loadRole()
{
$this->role = Role::getOneFromDb(['role_id' => $this->role_id, 'flag_delete' => FALSE], $this->dbConnection);
}
示例3: getRoles
public function getRoles()
{
$user_roles = array();
$user_roles = User_Role::getAllFromDb(['user_id' => $this->user_id], $this->dbConnection);
if (count($user_roles) <= 0) {
return array(Role::getOneFromDb(['name' => 'public'], $this->dbConnection));
}
// $roles = Role::getAllFromDb(['role_id'=>array_map(function($e){return $e->role_id;},$user_roles)],
$roles = Role::getAllFromDb(['role_id' => Db_Linked::arrayOfAttrValues($user_roles, 'role_id')], $this->dbConnection);
return $roles;
}
示例4: getRole
public function getRole()
{
return Role::getOneFromDb(['role_id' => $this->role_id, 'flag_delete' => FALSE], $this->dbConnection);
}