Ejemplo n.º 1
0
    /**
     * Deletes an associated ClassRegistration
     * @param ClassRegistration $objClassRegistration
     * @return void
     */
    public function DeleteAssociatedClassRegistration(ClassRegistration $objClassRegistration)
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateClassRegistration on this unsaved ClassGrade.');
        }
        if (is_null($objClassRegistration->SignupEntryId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateClassRegistration on this ClassGrade with an unsaved ClassRegistration.');
        }
        // Get the Database Object for this Class
        $objDatabase = ClassGrade::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`class_registration`
				WHERE
					`signup_entry_id` = ' . $objDatabase->SqlVariable($objClassRegistration->SignupEntryId) . ' AND
					`class_grade_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            $objClassRegistration->Journal('DELETE');
        }
    }