74 line
1.9KB

  1. <?php
  2. namespace Lc\ShopBundle\Model;
  3. use App\Entity\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 DocumentQuotation extends AbstractDocumentOrder
  11. {
  12. /**
  13. * @ORM\Column(type="integer", nullable=true)
  14. */
  15. protected $duration;
  16. /**
  17. * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="documentQuotation")
  18. */
  19. protected $orderShops;
  20. public function __construct()
  21. {
  22. $this->orderShops = new ArrayCollection();
  23. }
  24. public function getDuration(): ?int
  25. {
  26. return $this->duration;
  27. }
  28. public function setDuration(?int $duration): self
  29. {
  30. $this->duration = $duration;
  31. return $this;
  32. }
  33. /**
  34. * @return Collection|OrderShop[]
  35. */
  36. public function getOrderShops(): Collection
  37. {
  38. return $this->orderShops;
  39. }
  40. public function addOrderShop(OrderShop $orderShop): self
  41. {
  42. if (!$this->orderShops->contains($orderShop)) {
  43. $this->orderShops[] = $orderShop;
  44. $orderShop->setDocumentQuotation($this);
  45. }
  46. return $this;
  47. }
  48. public function removeOrderShop(OrderShop $orderShop): self
  49. {
  50. if ($this->orderShops->contains($orderShop)) {
  51. $this->orderShops->removeElement($orderShop);
  52. // set the owning side to null (unless already changed)
  53. if ($orderShop->getDocumentQuotation() === $this) {
  54. $orderShop->setDocumentQuotation(null);
  55. }
  56. }
  57. return $this;
  58. }
  59. }