/** * Gets all associated InventoryLocations as an array of InventoryLocation objects * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query * @return InventoryLocation[] */ public function GetInventoryLocationArray($objOptionalClauses = null) { if (is_null($this->intInventoryModelId)) { return array(); } try { return InventoryLocation::LoadArrayByInventoryModelId($this->intInventoryModelId, $objOptionalClauses); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }
/** * Deletes all associated InventoryLocations * @return void */ public function DeleteAllInventoryLocations() { if (is_null($this->intInventoryModelId)) { throw new QUndefinedPrimaryKeyException('Unable to call UnassociateInventoryLocation on this unsaved InventoryModel.'); } // Get the Database Object for this Class $objDatabase = InventoryModel::GetDatabase(); // Journaling if ($objDatabase->JournalingDatabase) { foreach (InventoryLocation::LoadArrayByInventoryModelId($this->intInventoryModelId) as $objInventoryLocation) { $objInventoryLocation->Journal('DELETE'); } } // Perform the SQL Query $objDatabase->NonQuery(' DELETE FROM `inventory_location` WHERE `inventory_model_id` = ' . $objDatabase->SqlVariable($this->intInventoryModelId) . ' '); }