Example #1
0
    /**
     * Deletes all associated StewardshipPostLineItems
     * @return void
     */
    public function DeleteAllStewardshipPostLineItems()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateStewardshipPostLineItem on this unsaved StewardshipFund.');
        }
        // Get the Database Object for this Class
        $objDatabase = StewardshipFund::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (StewardshipPostLineItem::LoadArrayByStewardshipFundId($this->intId) as $objStewardshipPostLineItem) {
                $objStewardshipPostLineItem->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`stewardship_post_line_item`
				WHERE
					`stewardship_fund_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }