Ejemplo n.º 1
0
    /**
     * Deletes an associated GroupRole
     * @param GroupRole $objGroupRole
     * @return void
     */
    public function DeleteAssociatedGroupRole(GroupRole $objGroupRole)
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateGroupRole on this unsaved Ministry.');
        }
        if (is_null($objGroupRole->Id)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateGroupRole on this Ministry with an unsaved GroupRole.');
        }
        // Get the Database Object for this Class
        $objDatabase = Ministry::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`group_role`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($objGroupRole->Id) . ' AND
					`ministry_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            $objGroupRole->Journal('DELETE');
        }
    }