當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Role::getOneFromDb方法代碼示例

本文整理匯總了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);
 }
開發者ID:cwarren,項目名稱:digitalfieldnotebooks,代碼行數:15,代碼來源:TestOfRole.class.php

示例2: loadRole

 public function loadRole()
 {
     $this->role = Role::getOneFromDb(['role_id' => $this->role_id, 'flag_delete' => FALSE], $this->dbConnection);
 }
開發者ID:cwarren,項目名稱:digitalfieldnotebooks,代碼行數:4,代碼來源:user_role.class.php

示例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;
 }
開發者ID:cwarren,項目名稱:digitalfieldnotebooks,代碼行數:11,代碼來源:user.class.php

示例4: getRole

 public function getRole()
 {
     return Role::getOneFromDb(['role_id' => $this->role_id, 'flag_delete' => FALSE], $this->dbConnection);
 }
開發者ID:cwarren,項目名稱:digitalfieldnotebooks,代碼行數:4,代碼來源:role_action_target.class.php


注:本文中的Role::getOneFromDb方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。