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