Author: Adam Piotrowski (adam@wellcommerce.org)
Inheritance: extends WellCommerce\Bundle\DoctrineBundle\Entity\AbstractEntity, implements WellCommerce\Bundle\OrderBundle\Entity\OrderInterface, use trait WellCommerce\Bundle\DoctrineBundle\Behaviours\Timestampable\TimestampableTrait, use trait WellCommerce\Bundle\ShopBundle\Entity\ShopAwareTrait, use trait WellCommerce\Bundle\ShippingBundle\Entity\ShippingMethodAwareTrait, use trait WellCommerce\Bundle\PaymentBundle\Entity\PaymentMethodAwareTrait, use trait WellCommerce\Bundle\ClientBundle\Entity\ClientAwareTrait, use trait WellCommerce\Bundle\ClientBundle\Entity\ClientContactDetailsAwareTrait, use trait WellCommerce\Bundle\ClientBundle\Entity\ClientBillingAddressAwareTrait, use trait WellCommerce\Bundle\ClientBundle\Entity\ClientShippingAddressAwareTrait, use trait WellCommerce\Bundle\CouponBundle\Entity\CouponAwareTrait
示例#1
0
 /**
  * @return \WellCommerce\Bundle\OrderBundle\Entity\OrderInterface
  */
 public function create()
 {
     $order = new Order();
     $order->setProducts(new ArrayCollection());
     $order->setPayments(new ArrayCollection());
     $order->setTotals(new ArrayCollection());
     return $order;
 }
示例#2
0
 public function create() : OrderInterface
 {
     $order = new Order();
     $order->setConfirmed(false);
     $order->setProducts($this->createEmptyCollection());
     $order->setProductTotal(new OrderProductTotal());
     $order->setModifiers($this->createEmptyCollection());
     $order->setPayments($this->createEmptyCollection());
     $order->setOrderStatusHistory($this->createEmptyCollection());
     $order->setComment('');
     $order->setCurrency($this->requestHelper->getCurrentCurrency());
     $order->setSummary(new OrderSummary());
     $order->setShop($this->shopStorage->getCurrentShop());
     $order->setClient($this->securityHelper->getCurrentClient());
     $order->setSessionId($this->requestHelper->getSessionId());
     $client = $this->securityHelper->getCurrentClient();
     if ($client instanceof ClientInterface) {
         $order->setClientDetails($client->getClientDetails());
         $order->setContactDetails($client->getContactDetails());
         $order->setBillingAddress($client->getBillingAddress());
         $order->setShippingAddress($client->getShippingAddress());
     } else {
         $order->setClientDetails($this->detailsFactory->create());
         $order->setContactDetails($this->contactDetailsFactory->create());
         $order->setBillingAddress($this->billingAddressFactory->create());
         $order->setShippingAddress($this->shippingAddressFactory->create());
     }
     return $order;
 }