PersonHoliday.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. namespace AppBundle\Entity\Booking;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Dunglas\ApiBundle\Annotation\Iri;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use AppBundle\Entity\AccessAndFunction\Access;
  9. /**
  10. * Périodes de vacances d'un Access
  11. *
  12. * @Iri("http://schema.org/PersonHoliday")
  13. *
  14. */
  15. #[ORM\Entity]
  16. class PersonHoliday extends AbstractBooking
  17. {
  18. /**
  19. * @var ArrayCollection<PersonHolidayRecur>
  20. */
  21. #[Assert\Valid]
  22. #[ORM\OneToMany(targetEntity: 'PersonHolidayRecur', mappedBy: 'event', cascade: ['persist'], orphanRemoval: true)]
  23. #[Groups(['personholiday_bookingrecur', 'accessholidays_list'])]
  24. protected $eventRecur;
  25. /**
  26. * @var Access
  27. */
  28. #[ORM\ManyToOne(targetEntity: '\AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'holidays')]
  29. #[Groups(['personholiday', 'accessholidays_list'])]
  30. private $access;
  31. /**
  32. * @var bool
  33. */
  34. #[ORM\Column(type: 'boolean', options: ['default' => false])]
  35. #[Assert\Type(type: 'boolean')]
  36. #[Assert\NotNull]
  37. #[Groups(['personholiday'])]
  38. private $approval = false;
  39. /**
  40. * @var int
  41. */
  42. #[ORM\Column(type: 'integer', nullable: true, options: ['default' => 0])]
  43. #[Assert\Type(type: 'integer', message: 'invalid-integer')]
  44. #[Groups(['personholiday'])]
  45. private $unpaidLeave;
  46. public function __construct()
  47. {
  48. parent::__construct();
  49. $this->eventRecur = new ArrayCollection();
  50. }
  51. /**
  52. * Sets access.
  53. *
  54. * @param Access $access
  55. *
  56. * @return $this
  57. */
  58. public function setAccess(Access $access = null)
  59. {
  60. $this->access = $access;
  61. return $this;
  62. }
  63. /**
  64. * Gets access.
  65. *
  66. * @return Access
  67. */
  68. public function getAccess()
  69. {
  70. return $this->access;
  71. }
  72. /**
  73. * Sets approval.
  74. *
  75. * @param bool $approval
  76. *
  77. * @return $this
  78. */
  79. public function setApproval($approval)
  80. {
  81. $this->approval = $approval;
  82. return $this;
  83. }
  84. /**
  85. * Gets approval.
  86. *
  87. * @return bool
  88. */
  89. public function getApproval()
  90. {
  91. return $this->approval;
  92. }
  93. /**
  94. * Sets unpaidLeave.
  95. *
  96. * @param int $unpaidLeave
  97. *
  98. * @return $this
  99. */
  100. public function setUnpaidLeave($unpaidLeave)
  101. {
  102. $this->unpaidLeave = $unpaidLeave;
  103. return $this;
  104. }
  105. /**
  106. * Gets unpaidLeave.
  107. *
  108. * @return int
  109. */
  110. public function getUnpaidLeave()
  111. {
  112. return $this->unpaidLeave;
  113. }
  114. }