OpeningHoursSpecification.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <?php
  2. namespace AppBundle\Entity\Place;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Dunglas\ApiBundle\Annotation\Iri;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. use AppBundle\Entity\Traits\TimestampableEntity;
  8. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  9. /**
  10. * Définition des plages d'ouverture d'une Place
  11. *
  12. * @Iri("http://schema.org/OpeningHoursSpecification")
  13. */
  14. #[ORM\Entity]
  15. class OpeningHoursSpecification
  16. {
  17. use TimestampableEntity;
  18. use CreatorUpdaterEntity;
  19. /**
  20. * @var int
  21. */
  22. #[ORM\Column(type: 'integer')]
  23. #[ORM\Id]
  24. #[ORM\GeneratedValue(strategy: 'AUTO')]
  25. #[Groups(['openinghoursspecification'])]
  26. private $id;
  27. /**
  28. * @var \DateTime The closing hour of the place or service on the given day(s) of the week.
  29. *
  30. * @Iri("https://schema.org/closes")
  31. */
  32. #[ORM\Column(type: 'time', nullable: true)]
  33. #[Assert\Time]
  34. #[Groups(['openinghoursspecification'])]
  35. private $closes;
  36. /**
  37. * @var array The day of the week for which these opening hours are valid.
  38. *
  39. * @Iri("https://schema.org/dayOfWeek")
  40. */
  41. #[ORM\Column(type: 'simple_array', nullable: true)]
  42. #[Assert\Type(type: 'array')]
  43. #[Assert\Choice(callback: ['\AppBundle\Enum\Place\DayOfWeekEnum', 'toArray'], multiple: true)]
  44. #[Groups(['openinghoursspecification'])]
  45. private $dayOfWeek;
  46. /**
  47. * @var \DateTime The opening hour of the place or service on the given day(s) of the week.
  48. *
  49. * @Iri("https://schema.org/opens")
  50. */
  51. #[ORM\Column(type: 'time', nullable: true)]
  52. #[Assert\Time]
  53. #[Groups(['openinghoursspecification'])]
  54. private $opens;
  55. /**
  56. * @var \DateTime The date when the item becomes valid.
  57. *
  58. * @Iri("https://schema.org/validFrom")
  59. */
  60. #[ORM\Column(type: 'datetime', nullable: true)]
  61. #[Assert\DateTime]
  62. #[Groups(['openinghoursspecification'])]
  63. private $validFrom;
  64. /**
  65. * @var \DateTime The end of the validity of offer, price specification, or opening hours data.
  66. *
  67. * @Iri("https://schema.org/validThrough")
  68. */
  69. #[ORM\Column(type: 'datetime', nullable: true)]
  70. #[Assert\DateTime]
  71. #[Groups(['openinghoursspecification'])]
  72. private $validThrough;
  73. /**
  74. * Sets id.
  75. *
  76. * @param int $id
  77. *
  78. * @return $this
  79. */
  80. public function setId($id)
  81. {
  82. $this->id = $id;
  83. return $this;
  84. }
  85. /**
  86. * Gets id.
  87. *
  88. * @return int
  89. */
  90. public function getId()
  91. {
  92. return $this->id;
  93. }
  94. /**
  95. * Sets closes.
  96. *
  97. * @param \DateTime $closes
  98. *
  99. * @return $this
  100. */
  101. public function setCloses(\DateTime $closes = null)
  102. {
  103. $this->closes = $closes;
  104. return $this;
  105. }
  106. /**
  107. * Gets closes.
  108. *
  109. * @return \DateTime
  110. */
  111. public function getCloses()
  112. {
  113. return $this->closes;
  114. }
  115. /**
  116. * Sets dayOfWeek.
  117. *
  118. * @param array $dayOfWeek
  119. *
  120. * @return $this
  121. */
  122. public function setDayOfWeek($dayOfWeek)
  123. {
  124. $this->dayOfWeek = $dayOfWeek;
  125. return $this;
  126. }
  127. /**
  128. * Gets dayOfWeek.
  129. *
  130. * @return array
  131. */
  132. public function getDayOfWeek()
  133. {
  134. return $this->dayOfWeek;
  135. }
  136. /**
  137. * Sets opens.
  138. *
  139. * @param \DateTime $opens
  140. *
  141. * @return $this
  142. */
  143. public function setOpens(\DateTime $opens = null)
  144. {
  145. $this->opens = $opens;
  146. return $this;
  147. }
  148. /**
  149. * Gets opens.
  150. *
  151. * @return \DateTime
  152. */
  153. public function getOpens()
  154. {
  155. return $this->opens;
  156. }
  157. /**
  158. * Sets validFrom.
  159. *
  160. * @param \DateTime $validFrom
  161. *
  162. * @return $this
  163. */
  164. public function setValidFrom(\DateTime $validFrom = null)
  165. {
  166. $this->validFrom = $validFrom;
  167. return $this;
  168. }
  169. /**
  170. * Gets validFrom.
  171. *
  172. * @return \DateTime
  173. */
  174. public function getValidFrom()
  175. {
  176. return $this->validFrom;
  177. }
  178. /**
  179. * Sets validThrough.
  180. *
  181. * @param \DateTime $validThrough
  182. *
  183. * @return $this
  184. */
  185. public function setValidThrough(\DateTime $validThrough = null)
  186. {
  187. $this->validThrough = $validThrough;
  188. return $this;
  189. }
  190. /**
  191. * Gets validThrough.
  192. *
  193. * @return \DateTime
  194. */
  195. public function getValidThrough()
  196. {
  197. return $this->validThrough;
  198. }
  199. }