Example #1
0
    /**
     * Deletes all associated StewardshipPledges
     * @return void
     */
    public function DeleteAllStewardshipPledges()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateStewardshipPledge on this unsaved Person.');
        }
        // Get the Database Object for this Class
        $objDatabase = Person::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (StewardshipPledge::LoadArrayByPersonId($this->intId) as $objStewardshipPledge) {
                $objStewardshipPledge->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`stewardship_pledge`
				WHERE
					`person_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }