Exemple #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 Address.');
        }
        // Get the Database Object for this Class
        $objDatabase = Address::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (FormAnswer::LoadArrayByAddressId($this->intId) as $objFormAnswer) {
                $objFormAnswer->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`form_answer`
				WHERE
					`address_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }