選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

56 行
1.6KB

  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. }