Ejemplo n.º 1
0
    /**
     * Deletes all associated InventoryModels
     * @return void
     */
    public function DeleteAllInventoryModels()
    {
        if (is_null($this->intManufacturerId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateInventoryModel on this unsaved Manufacturer.');
        }
        // Get the Database Object for this Class
        $objDatabase = Manufacturer::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (InventoryModel::LoadArrayByManufacturerId($this->intManufacturerId) as $objInventoryModel) {
                $objInventoryModel->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`inventory_model`
				WHERE
					`manufacturer_id` = ' . $objDatabase->SqlVariable($this->intManufacturerId) . '
			');
    }
Ejemplo n.º 2
0
 /**
  * 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->intManufacturerId)) {
         return array();
     }
     try {
         return InventoryModel::LoadArrayByManufacturerId($this->intManufacturerId, $objOptionalClauses);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }