Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

ReductionPropertyTrait.php 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <?php
  2. namespace Lc\CaracoleBundle\Doctrine\Extension;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
  7. use Lc\SovBundle\Model\User\GroupUserInterface;
  8. use Lc\SovBundle\Model\User\UserInterface;
  9. trait ReductionPropertyTrait
  10. {
  11. /**
  12. * @ORM\ManyToMany(targetEntity="Lc\SovBundle\Model\User\UserInterface")
  13. */
  14. protected $users;
  15. /**
  16. * @ORM\ManyToMany(targetEntity="Lc\SovBundle\Model\User\GroupUserInterface")
  17. */
  18. protected $groupUsers;
  19. /**
  20. * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="productFamilies")
  21. * @ORM\JoinColumn(nullable=false)
  22. */
  23. protected $merchant;
  24. /**
  25. * @ORM\Column(type="datetime", nullable=true)
  26. */
  27. protected $dateStart;
  28. /**
  29. * @ORM\Column(type="datetime", nullable=true)
  30. */
  31. protected $dateEnd;
  32. /**
  33. * @ORM\Column(type="boolean")
  34. */
  35. protected $permanent;
  36. public function __construct()
  37. {
  38. $this->users = new ArrayCollection();
  39. $this->groupUsers = new ArrayCollection();
  40. }
  41. public function getMerchant(): ?MerchantInterface
  42. {
  43. return $this->merchant;
  44. }
  45. public function setMerchant(?MerchantInterface $merchant): self
  46. {
  47. $this->merchant = $merchant;
  48. return $this;
  49. }
  50. /**
  51. * @return Collection|UserInterface[]
  52. */
  53. public function getUsers(): Collection
  54. {
  55. return $this->users;
  56. }
  57. public function addUser(UserInterface $user): self
  58. {
  59. if (!$this->users->contains($user)) {
  60. $this->users[] = $user;
  61. }
  62. return $this;
  63. }
  64. public function removeUser(UserInterface $user): self
  65. {
  66. if ($this->users->contains($user)) {
  67. $this->users->removeElement($user);
  68. }
  69. return $this;
  70. }
  71. /**
  72. * @return Collection|GroupUserInterface[]
  73. */
  74. public function getGroupUsers(): Collection
  75. {
  76. return $this->groupUsers;
  77. }
  78. public function addGroupUser(GroupUserInterface $groupUser): self
  79. {
  80. if (!$this->groupUsers->contains($groupUser)) {
  81. $this->groupUsers[] = $groupUser;
  82. }
  83. return $this;
  84. }
  85. public function removeGroupUser(GroupUserInterface $groupUser): self
  86. {
  87. if ($this->groupUsers->contains($groupUser)) {
  88. $this->groupUsers->removeElement($groupUser);
  89. }
  90. return $this;
  91. }
  92. public function getDateStart(): ?\DateTimeInterface
  93. {
  94. return $this->dateStart;
  95. }
  96. public function setDateStart(?\DateTimeInterface $dateStart): self
  97. {
  98. $this->dateStart = $dateStart;
  99. return $this;
  100. }
  101. public function getDateEnd(): ?\DateTimeInterface
  102. {
  103. return $this->dateEnd;
  104. }
  105. public function setDateEnd(?\DateTimeInterface $dateEnd): self
  106. {
  107. $this->dateEnd = $dateEnd;
  108. return $this;
  109. }
  110. public function getPermanent(): ?bool
  111. {
  112. return $this->permanent;
  113. }
  114. public function setPermanent(bool $permanent): self
  115. {
  116. $this->permanent = $permanent;
  117. return $this;
  118. }
  119. }