コード例 #1
0
ファイル: PersonGen.class.php プロジェクト: alcf/chms
    /**
     * Deletes all associated MarriagesAsMarriedTo
     * @return void
     */
    public function DeleteAllMarriagesAsMarriedTo()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateMarriageAsMarriedTo on this unsaved Person.');
        }
        // Get the Database Object for this Class
        $objDatabase = Person::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (Marriage::LoadArrayByMarriedToPersonId($this->intId) as $objMarriage) {
                $objMarriage->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`marriage`
				WHERE
					`married_to_person_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }