Пример #1
0
 /**
  * Gets all associated ShipmentsAsFrom as an array of Shipment objects
  * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  * @return Shipment[]
  */
 public function GetShipmentAsFromArray($objOptionalClauses = null)
 {
     if (is_null($this->intAddressId)) {
         return array();
     }
     try {
         return Shipment::LoadArrayByFromAddressId($this->intAddressId, $objOptionalClauses);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
Пример #2
0
    /**
     * Deletes all associated ShipmentsAsFrom
     * @return void
     */
    public function DeleteAllShipmentsAsFrom()
    {
        if (is_null($this->intAddressId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateShipmentAsFrom on this unsaved Address.');
        }
        // Get the Database Object for this Class
        $objDatabase = Address::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (Shipment::LoadArrayByFromAddressId($this->intAddressId) as $objShipment) {
                $objShipment->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`shipment`
				WHERE
					`from_address_id` = ' . $objDatabase->SqlVariable($this->intAddressId) . '
			');
    }