Esempio n. 1
0
    /**
     * Unassociates all GrowthGroupStructures
     * @return void
     */
    public function UnassociateAllGrowthGroupStructures()
    {
        if (is_null($this->intGroupId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAllGrowthGroupStructureArray on this unsaved GrowthGroup.');
        }
        // Get the Database Object for this Class
        $objDatabase = GrowthGroup::GetDatabase();
        // Journaling (if applicable)
        if ($objDatabase->JournalingDatabase) {
            $objResult = $objDatabase->Query('SELECT `growth_group_structure_id` AS associated_id FROM `growthgroupstructure_growthgroup_assn` WHERE `growth_group_id` = ' . $objDatabase->SqlVariable($this->intGroupId));
            while ($objRow = $objResult->GetNextRow()) {
                $this->JournalGrowthGroupStructureAssociation($objRow->GetColumn('associated_id'), 'DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`growthgroupstructure_growthgroup_assn`
				WHERE
					`growth_group_id` = ' . $objDatabase->SqlVariable($this->intGroupId) . '
			');
    }