Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

DocumentDeliveryNote.php 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace Lc\ShopBundle\Model;
  3. use Lc\ShopBundle\Model\OrderShop;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\MappedSuperclass()
  9. */
  10. abstract class DocumentDeliveryNote extends AbstractDocumentOrder
  11. {
  12. /**
  13. * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="documentDeliveryNote")
  14. */
  15. protected $orderShops;
  16. public function __construct()
  17. {
  18. $this->orderShops = new ArrayCollection();
  19. }
  20. /**
  21. * @return Collection|OrderShop[]
  22. */
  23. public function getOrderShops(): Collection
  24. {
  25. return $this->orderShops;
  26. }
  27. public function addOrderShop(OrderShop $orderShop): self
  28. {
  29. if (!$this->orderShops->contains($orderShop)) {
  30. $this->orderShops[] = $orderShop;
  31. $orderShop->setDocumentDeliveryNote($this);
  32. }
  33. return $this;
  34. }
  35. public function removeOrderShop(OrderShop $orderShop): self
  36. {
  37. if ($this->orderShops->contains($orderShop)) {
  38. $this->orderShops->removeElement($orderShop);
  39. // set the owning side to null (unless already changed)
  40. if ($orderShop->getDocumentDeliveryNote() === $this) {
  41. $orderShop->setDocumentDeliveryNote(null);
  42. }
  43. }
  44. return $this;
  45. }
  46. }