예제 #1
0
    /**
     * Deletes all associated CommunicationLists
     * @return void
     */
    public function DeleteAllCommunicationLists()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateCommunicationList on this unsaved Ministry.');
        }
        // Get the Database Object for this Class
        $objDatabase = Ministry::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (CommunicationList::LoadArrayByMinistryId($this->intId) as $objCommunicationList) {
                $objCommunicationList->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`communication_list`
				WHERE
					`ministry_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }