Example #1
0
    /**
     * Deletes all associated FormAnswers
     * @return void
     */
    public function DeleteAllFormAnswers()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateFormAnswer on this unsaved Email.');
        }
        // Get the Database Object for this Class
        $objDatabase = Email::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (FormAnswer::LoadArrayByEmailId($this->intId) as $objFormAnswer) {
                $objFormAnswer->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`form_answer`
				WHERE
					`email_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }