Ejemplo n.º 1
0
    /**
     * Deletes an associated FormQuestion
     * @param FormQuestion $objFormQuestion
     * @return void
     */
    public function DeleteAssociatedFormQuestion(FormQuestion $objFormQuestion)
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateFormQuestion on this unsaved SignupForm.');
        }
        if (is_null($objFormQuestion->Id)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateFormQuestion on this SignupForm with an unsaved FormQuestion.');
        }
        // Get the Database Object for this Class
        $objDatabase = SignupForm::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`form_question`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($objFormQuestion->Id) . ' AND
					`signup_form_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            $objFormQuestion->Journal('DELETE');
        }
    }