Пример #1
0
    /**
     * Deletes an associated RoleModule
     * @param RoleModule $objRoleModule
     * @return void
     */
    public function DeleteAssociatedRoleModule(RoleModule $objRoleModule)
    {
        if (is_null($this->intRoleId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateRoleModule on this unsaved Role.');
        }
        if (is_null($objRoleModule->RoleModuleId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateRoleModule on this Role with an unsaved RoleModule.');
        }
        // Get the Database Object for this Class
        $objDatabase = Role::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`role_module`
				WHERE
					`role_module_id` = ' . $objDatabase->SqlVariable($objRoleModule->RoleModuleId) . ' AND
					`role_id` = ' . $objDatabase->SqlVariable($this->intRoleId) . '
			');
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            $objRoleModule->Journal('DELETE');
        }
    }