예제 #1
0
    /**
     * Deletes all associated SmsMessages
     * @return void
     */
    public function DeleteAllSmsMessages()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateSmsMessage on this unsaved Login.');
        }
        // Get the Database Object for this Class
        $objDatabase = Login::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (SmsMessage::LoadArrayByLoginId($this->intId) as $objSmsMessage) {
                $objSmsMessage->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`sms_message`
				WHERE
					`login_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }