elements = new ArrayCollection(); $this->notificationMethod = self::NOTIFY_MAIL; } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * @return User */ public function getUser() { return $this->user; } /** * @param User $user * * @return Order */ public function setUser(User $user) { $this->user = $user; return $this; } /** * Get deadline * * @return \DateTime */ public function getDeadline() { return $this->deadline; } /** * Set deadline * * @param \DateTime $deadline * @return Order */ public function setDeadline($deadline) { $this->deadline = $deadline; return $this; } /** * Get created_on * * @return \DateTime */ public function getCreatedOn() { return $this->createdOn; } /** * Set created_on * * @param \DateTime $createdOn * @return Order */ public function setCreatedOn($createdOn) { $this->createdOn = $createdOn; return $this; } /** * Add elements * * @param OrderElement $elements * @return Order */ public function addElement(OrderElement $elements) { $this->elements[] = $elements; $elements->setOrder($this); return $this; } /** * Remove elements * * @param OrderElement $elements */ public function removeElement(OrderElement $elements) { $this->elements->removeElement($elements); $elements->setOrder(null); } /** * Get elements * * @return OrderElement[]|\Doctrine\Common\Collections\Collection */ public function getElements() { return $this->elements; } /** * Get todo * * @return integer */ public function getTodo() { return $this->todo; } /** * Set todo * * @param integer $todo * @return Order */ public function setTodo($todo) { $this->todo = $todo; return $this; } /** * @param int $count */ public function decrementTodo($count) { $this->todo -= $count; } /** * Returns the total number of elements. * * @return integer */ public function getTotal() { return count($this->elements); } public function getTotalTreatedItems() { $count = 0; foreach($this->elements as $element) { if(!is_null($element->getDeny())) { $count++; } } return $count; } /** * Get order_usage * * @return string */ public function getOrderUsage() { return $this->orderUsage; } /** * Set order_usage * * @param string $orderUsage * @return Order */ public function setOrderUsage($orderUsage) { $this->orderUsage = $orderUsage; return $this; } /** * Get basket * * @return Basket */ public function getBasket() { return $this->basket; } /** * Set basket * * @param Basket $basket * @return Order */ public function setBasket(Basket $basket = null) { if ($this->basket) { $this->basket->setOrder(null); } $this->basket = $basket; if ($basket) { $basket->setOrder($this); } return $this; } /** * @return string The name of the notification method that will be used to handle this order's status change * notifications. */ public function getNotificationMethod() { return $this->notificationMethod; } /** * Sets the name of the notification method to handle this order's status change * notifications. * @param string $methodName * @return void */ public function setNotificationMethod($methodName) { if (trim($methodName) == '') { $methodName = self::NOTIFY_MAIL; } $this->notificationMethod = $methodName; } /** * @param \DateTime $canceledOn * @return $this */ public function setCanceledOn($canceledOn) { $this->canceledOn = $canceledOn; return $this; } public function getCanceledOn() { return $this->canceledOn; } /** * @param $canceledBy * @return $this */ public function setCanceledBy($canceledBy) { $this->canceledBy = $canceledBy; return $this; } public function getCanceledBy() { return $this->canceledBy; } /** * @param $canceledTodo * @return $this */ public function setCanceledTodo($canceledTodo) { $this->canceledTodo = $canceledTodo; return $this; } public function getCanceledTodo() { return $this->canceledTodo; } }