/** * Deletes all associated AssetModels * @return void */ public function DeleteAllAssetModels() { if (is_null($this->intDepreciationClassId)) { throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAssetModel on this unsaved DepreciationClass.'); } // Get the Database Object for this Class $objDatabase = DepreciationClass::GetDatabase(); // Journaling if ($objDatabase->JournalingDatabase) { foreach (AssetModel::LoadArrayByDepreciationClassId($this->intDepreciationClassId) as $objAssetModel) { $objAssetModel->Journal('DELETE'); } } // Perform the SQL Query $objDatabase->NonQuery(' DELETE FROM `asset_model` WHERE `depreciation_class_id` = ' . $objDatabase->SqlVariable($this->intDepreciationClassId) . ' '); }