src/Entity/SaleOrderValidation.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SaleOrderValidationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use JMS\Serializer\Annotation as Serializer;
  8. use JMS\Serializer\Annotation\Expose;
  9. use JMS\Serializer\Annotation\Groups;
  10. /**
  11. * @ORM\Entity(repositoryClass=SaleOrderValidationRepository::class)
  12. *
  13. * @Serializer\ExclusionPolicy("ALL")
  14. */
  15. class SaleOrderValidation
  16. {
  17. /**
  18. * @ORM\Id
  19. * @ORM\GeneratedValue
  20. * @ORM\Column(type="integer")
  21. *
  22. * @Expose
  23. * @Groups({"sale_order","saleordervalidation","user"})
  24. */
  25. private $id;
  26. /**
  27. * @ORM\Column(type="string", length=255)
  28. *
  29. * @Expose
  30. * @Groups({"sale_order","saleordervalidation","user"})
  31. */
  32. private $level;
  33. /**
  34. * @ORM\Column(type="integer")
  35. *
  36. * @Expose
  37. * @Groups({"sale_order","saleordervalidation","user"})
  38. */
  39. private $amount;
  40. /**
  41. * @ORM\OneToMany(targetEntity=User::class, mappedBy="saleOrderValidation")
  42. *
  43. * @Expose
  44. * @Groups({"user", "export_user_datatable", "saleordervalidation"})
  45. */
  46. private $users;
  47. /**
  48. * @ORM\Column(type="boolean", nullable=true)
  49. *
  50. * @Expose
  51. * @Groups({"sale_order","saleordervalidation","user"})
  52. */
  53. private $isDefault;
  54. public function __construct()
  55. {
  56. $this->users = new ArrayCollection();
  57. }
  58. public function getId()
  59. {
  60. return $this->id;
  61. }
  62. public function getLevel()
  63. {
  64. return $this->level;
  65. }
  66. public function setLevel( string $level ): self
  67. {
  68. $this->level = $level;
  69. return $this;
  70. }
  71. public function getAmount(): ?int
  72. {
  73. return $this->amount;
  74. }
  75. public function setAmount( int $amount ): self
  76. {
  77. $this->amount = $amount;
  78. return $this;
  79. }
  80. /**
  81. * @return Collection<int, User>
  82. */
  83. public function getUsers(): Collection
  84. {
  85. return $this->users;
  86. }
  87. public function addUser( User $user ): self
  88. {
  89. if ( !$this->users->contains( $user ) ) {
  90. $this->users[] = $user;
  91. $user->setSaleOrderValidation( $this );
  92. }
  93. return $this;
  94. }
  95. public function removeUser( User $user ): self
  96. {
  97. if ( $this->users->removeElement( $user ) ) {
  98. // set the owning side to null (unless already changed)
  99. if ( $user->getSaleOrderValidation() === $this ) {
  100. $user->setSaleOrderValidation( null );
  101. }
  102. }
  103. return $this;
  104. }
  105. public function isIsDefault(): ?bool
  106. {
  107. return $this->isDefault;
  108. }
  109. public function setIsDefault( ?bool $isDefault ): self
  110. {
  111. $this->isDefault = $isDefault;
  112. return $this;
  113. }
  114. }