You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 DocumentInvoice extends AbstractDocumentOrder
  11. {
  12. /**
  13. * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="documentInvoice")
  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->setDocumentInvoice($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->getDocumentInvoice() === $this) {
  41. $orderShop->setDocumentInvoice(null);
  42. }
  43. }
  44. return $this;
  45. }
  46. }