示例#1
0
    /**
     * Deletes all associated StewardshipFunds
     * @return void
     */
    public function DeleteAllStewardshipFunds()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateStewardshipFund on this unsaved Ministry.');
        }
        // Get the Database Object for this Class
        $objDatabase = Ministry::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (StewardshipFund::LoadArrayByMinistryId($this->intId) as $objStewardshipFund) {
                $objStewardshipFund->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`stewardship_fund`
				WHERE
					`ministry_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }