示例#1
0
    /**
     * Unassociates all GrowthGroupStructuresAsGroupstructure
     * @return void
     */
    public function UnassociateAllGrowthGroupStructuresAsGroupstructure()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAllGrowthGroupStructureAsGroupstructureArray on this unsaved GroupRegistrations.');
        }
        // Get the Database Object for this Class
        $objDatabase = GroupRegistrations::GetDatabase();
        // Journaling (if applicable)
        if ($objDatabase->JournalingDatabase) {
            $objResult = $objDatabase->Query('SELECT `group_structure_id` AS associated_id FROM `groupregistrations_groupstructure_assn` WHERE `group_registrations_id` = ' . $objDatabase->SqlVariable($this->intId));
            while ($objRow = $objResult->GetNextRow()) {
                $this->JournalGrowthGroupStructureAsGroupstructureAssociation($objRow->GetColumn('associated_id'), 'DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`groupregistrations_groupstructure_assn`
				WHERE
					`group_registrations_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }