/**
  * @param ChildOrder $childOrder
  * @return $this
  */
 protected function addChildOrder(ChildOrder $childOrder)
 {
     if (!$this->childOrderList instanceof ChildOrderList) {
         $this->childOrderList = new ChildOrderList();
     }
     $this->childOrderList->add($childOrder);
     return $this;
 }
Exemple #2
0
 /**
  * @param  ChildOrder $order The ChildOrder object to remove.
  * @return $this|ChildUser The current object (for fluent API support)
  */
 public function removeOrder(ChildOrder $order)
 {
     if ($this->getOrders()->contains($order)) {
         $pos = $this->collOrders->search($order);
         $this->collOrders->remove($pos);
         if (null === $this->ordersScheduledForDeletion) {
             $this->ordersScheduledForDeletion = clone $this->collOrders;
             $this->ordersScheduledForDeletion->clear();
         }
         $this->ordersScheduledForDeletion[] = clone $order;
         $order->setUser(null);
     }
     return $this;
 }