示例#1
0
    /**
     * Deletes an associated SmsMessage
     * @param SmsMessage $objSmsMessage
     * @return void
     */
    public function DeleteAssociatedSmsMessage(SmsMessage $objSmsMessage)
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateSmsMessage on this unsaved Login.');
        }
        if (is_null($objSmsMessage->Id)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateSmsMessage on this Login with an unsaved SmsMessage.');
        }
        // Get the Database Object for this Class
        $objDatabase = Login::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`sms_message`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($objSmsMessage->Id) . ' AND
					`login_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            $objSmsMessage->Journal('DELETE');
        }
    }