Пример #1
0
 function loadById($ROL_UID)
 {
     $oCriteria = new Criteria('rbac');
     $oCriteria->addSelectColumn(RolesPeer::ROL_UID);
     $oCriteria->addSelectColumn(RolesPeer::ROL_PARENT);
     $oCriteria->addSelectColumn(RolesPeer::ROL_SYSTEM);
     $oCriteria->addSelectColumn(RolesPeer::ROL_CODE);
     $oCriteria->addSelectColumn(RolesPeer::ROL_CREATE_DATE);
     $oCriteria->addSelectColumn(RolesPeer::ROL_UPDATE_DATE);
     $oCriteria->addSelectColumn(RolesPeer::ROL_STATUS);
     $oCriteria->add(RolesPeer::ROL_UID, $ROL_UID);
     $result = RolesPeer::doSelectRS($oCriteria);
     $result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $result->next();
     $row = $result->getRow();
     if (is_array($row)) {
         $o = RolesPeer::retrieveByPK($row['ROL_UID']);
         $row['ROL_NAME'] = $o->getRolName();
         if ($row['ROL_NAME'] == '') {
             $row['ROL_NAME'] = $o->getRolCode();
         }
         return $row;
     } else {
         return null;
     }
 }
Пример #2
0
 /**
  * Verify if does not exist the Role in table ROLES
  *
  * @param string $roleUid               Unique id of Role
  * @param string $fieldNameForException Field name for the exception
  *
  * return void Throw exception if does not exist the Role in table ROLES
  */
 public function throwExceptionIfNotExistsRole($roleUid, $fieldNameForException)
 {
     try {
         $obj = \RolesPeer::retrieveByPK($roleUid);
         if (is_null($obj)) {
             throw new \Exception(\G::LoadTranslation("ID_ROLE_DOES_NOT_EXIST", array($fieldNameForException, $roleUid)));
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }