Exemplo n.º 1
0
 /**
  *
  * @param OnlineProduct $product
  *            Constructor
  */
 public function __construct(OnlineOrderProduct $product = null)
 {
     if (null != $product) {
         $this->label = $product->getLabel();
         $this->price = $product->getPrice();
         $this->vat = $product->getVat();
     } else {
         $this->price = 0;
         $this->vat = 0;
     }
     $this->dtCrea = new \DateTime('now');
 }
Exemplo n.º 2
0
 /**
  * Add product
  *
  * @param OnlineOrderProduct $product
  *
  * @return OnlineOrder
  */
 public function addProduct(OnlineOrderProduct $product)
 {
     $product->setOrder($this);
     $this->products[] = $product;
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Add order
  *
  * @param OnlineOrderProduct $order
  *
  * @return OnlineProduct
  */
 public function addOrder(OnlineOrderProduct $order)
 {
     $order->setProduct($this);
     $this->orders[] = $order;
     return $this;
 }