Example #1
0
    /**
     * Deletes an associated EmailMessageRoute
     * @param EmailMessageRoute $objEmailMessageRoute
     * @return void
     */
    public function DeleteAssociatedEmailMessageRoute(EmailMessageRoute $objEmailMessageRoute)
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateEmailMessageRoute on this unsaved CommunicationList.');
        }
        if (is_null($objEmailMessageRoute->Id)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateEmailMessageRoute on this CommunicationList with an unsaved EmailMessageRoute.');
        }
        // Get the Database Object for this Class
        $objDatabase = CommunicationList::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`email_message_route`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($objEmailMessageRoute->Id) . ' AND
					`communication_list_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            $objEmailMessageRoute->Journal('DELETE');
        }
    }