/** * Deletes all associated Marriages * @return void */ public function DeleteAllMarriages() { if (is_null($this->intId)) { throw new QUndefinedPrimaryKeyException('Unable to call UnassociateMarriage on this unsaved Person.'); } // Get the Database Object for this Class $objDatabase = Person::GetDatabase(); // Journaling if ($objDatabase->JournalingDatabase) { foreach (Marriage::LoadArrayByPersonId($this->intId) as $objMarriage) { $objMarriage->Journal('DELETE'); } } // Perform the SQL Query $objDatabase->NonQuery(' DELETE FROM `marriage` WHERE `person_id` = ' . $objDatabase->SqlVariable($this->intId) . ' '); }