예제 #1
0
    /**
     * Deletes all associated GrowthGroups
     * @return void
     */
    public function DeleteAllGrowthGroups()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateGrowthGroup on this unsaved GrowthGroupLocation.');
        }
        // Get the Database Object for this Class
        $objDatabase = GrowthGroupLocation::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (GrowthGroup::LoadArrayByGrowthGroupLocationId($this->intId) as $objGrowthGroup) {
                $objGrowthGroup->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`growth_group`
				WHERE
					`growth_group_location_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }