/** * Deletes all associated AssetModels * @return void */ public function DeleteAllAssetModels() { if (is_null($this->intCategoryId)) { throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAssetModel on this unsaved Category.'); } // Get the Database Object for this Class $objDatabase = Category::GetDatabase(); // Journaling if ($objDatabase->JournalingDatabase) { foreach (AssetModel::LoadArrayByCategoryId($this->intCategoryId) as $objAssetModel) { $objAssetModel->Journal('DELETE'); } } // Perform the SQL Query $objDatabase->NonQuery(' DELETE FROM `asset_model` WHERE `category_id` = ' . $objDatabase->SqlVariable($this->intCategoryId) . ' '); }
/** * Gets all associated AssetModels as an array of AssetModel objects * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query * @return AssetModel[] */ public function GetAssetModelArray($objOptionalClauses = null) { if (is_null($this->intCategoryId)) { return array(); } try { return AssetModel::LoadArrayByCategoryId($this->intCategoryId, $objOptionalClauses); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }