コード例 #1
0
ファイル: OrderController.php プロジェクト: margery/thelia
 /**
  * @param AbstractDeliveryModule $moduleInstance
  * @param Address $deliveryAddress
  * @return \Symfony\Component\HttpFoundation\Response
  */
 private function registerVirtualProductDelivery($moduleInstance, $deliveryAddress)
 {
     /* get postage amount */
     $deliveryModule = $moduleInstance->getModuleModel();
     $postage = OrderPostage::loadFromPostage($moduleInstance->getPostage($deliveryAddress->getCountry()));
     $orderEvent = $this->getOrderEvent();
     $orderEvent->setDeliveryAddress($deliveryAddress->getId());
     $orderEvent->setDeliveryModule($deliveryModule->getId());
     $orderEvent->setPostage($postage->getAmount());
     $orderEvent->setPostageTax($postage->getAmountTax());
     $orderEvent->setPostageTaxRuleTitle($postage->getTaxRuleTitle());
     $this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_ADDRESS, $orderEvent);
     $this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_MODULE, $orderEvent);
     $this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_POSTAGE, $orderEvent);
     return $this->generateRedirectFromRoute("order.invoice");
 }
コード例 #2
0
ファイル: Cart.php プロジェクト: alex63530/thelia
 /**
  * Declares an association between this object and a ChildAddress object.
  *
  * @param                  ChildAddress $v
  * @return                 \Thelia\Model\Cart The current object (for fluent API support)
  * @throws PropelException
  */
 public function setAddressRelatedByAddressInvoiceId(ChildAddress $v = null)
 {
     if ($v === null) {
         $this->setAddressInvoiceId(NULL);
     } else {
         $this->setAddressInvoiceId($v->getId());
     }
     $this->aAddressRelatedByAddressInvoiceId = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildAddress object, it will not be re-added.
     if ($v !== null) {
         $v->addCartRelatedByAddressInvoiceId($this);
     }
     return $this;
 }
コード例 #3
0
ファイル: CartQuery.php プロジェクト: alex63530/thelia
 /**
  * Filter the query by a related \Thelia\Model\Address object
  *
  * @param \Thelia\Model\Address|ObjectCollection $address The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildCartQuery The current query, for fluid interface
  */
 public function filterByAddressRelatedByAddressInvoiceId($address, $comparison = null)
 {
     if ($address instanceof \Thelia\Model\Address) {
         return $this->addUsingAlias(CartTableMap::ADDRESS_INVOICE_ID, $address->getId(), $comparison);
     } elseif ($address instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(CartTableMap::ADDRESS_INVOICE_ID, $address->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByAddressRelatedByAddressInvoiceId() only accepts arguments of type \\Thelia\\Model\\Address or Collection');
     }
 }
コード例 #4
0
ファイル: AddressQuery.php プロジェクト: zorn-v/thelia
 /**
  * Exclude object from result
  *
  * @param   ChildAddress $address Object to remove from the list of results
  *
  * @return ChildAddressQuery The current query, for fluid interface
  */
 public function prune($address = null)
 {
     if ($address) {
         $this->addUsingAlias(AddressTableMap::ID, $address->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }