コード例 #1
0
ファイル: FormQuestionGen.class.php プロジェクト: alcf/chms
    /**
     * Deletes all associated FormAnswers
     * @return void
     */
    public function DeleteAllFormAnswers()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateFormAnswer on this unsaved FormQuestion.');
        }
        // Get the Database Object for this Class
        $objDatabase = FormQuestion::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (FormAnswer::LoadArrayByFormQuestionId($this->intId) as $objFormAnswer) {
                $objFormAnswer->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`form_answer`
				WHERE
					`form_question_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }