Ejemplo n.º 1
0
    /**
     * Deletes all associated RoleModules
     * @return void
     */
    public function DeleteAllRoleModules()
    {
        if (is_null($this->intRoleId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateRoleModule on this unsaved Role.');
        }
        // Get the Database Object for this Class
        $objDatabase = Role::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (RoleModule::LoadArrayByRoleId($this->intRoleId) as $objRoleModule) {
                $objRoleModule->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`role_module`
				WHERE
					`role_id` = ' . $objDatabase->SqlVariable($this->intRoleId) . '
			');
    }
Ejemplo n.º 2
0
 /**
  * Gets all associated RoleModules as an array of RoleModule objects
  * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  * @return RoleModule[]
  */
 public function GetRoleModuleArray($objOptionalClauses = null)
 {
     if (is_null($this->intRoleId)) {
         return array();
     }
     try {
         return RoleModule::LoadArrayByRoleId($this->intRoleId, $objOptionalClauses);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }