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