BillPeriod.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <?php
  2. namespace AppBundle\Entity\Billing;
  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\Traits\TimestampableEntity;
  9. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  10. /**
  11. * Période associée à une facture
  12. * (Ex: Deuxième trimestre 2020)
  13. *
  14. * @Iri("http://schema.org/BillPeriod")
  15. */
  16. #[ORM\Entity]
  17. class BillPeriod
  18. {
  19. use TimestampableEntity;
  20. use CreatorUpdaterEntity;
  21. /**
  22. * @var int
  23. */
  24. #[ORM\Column(type: 'integer')]
  25. #[ORM\Id]
  26. #[ORM\GeneratedValue(strategy: 'AUTO')]
  27. #[Groups(['billperiod', 'billaccounting_list', 'bill_list', 'billcredit_list', 'advancepayment_list', 'build_bills', 'billcredit_list', 'advancepayment_list'])]
  28. private $id;
  29. /**
  30. * @var
  31. */
  32. #[ORM\Column(type: 'string', nullable: true)]
  33. #[Assert\Type(type: 'string')]
  34. #[Assert\Choice(callback: ['\AppBundle\Enum\Billing\PeriodicityEnum', 'toArray'])]
  35. #[Groups(['billperiod', 'billaccounting_list_billperiod', 'bill_list_billperiod', 'billcredit_list_billperiod', 'build_bills_billperiod'])]
  36. private $periodicity;
  37. /**
  38. * @var string
  39. *
  40. *
  41. */
  42. #[ORM\Column(type: 'string', nullable: true)]
  43. #[Assert\Type(type: 'string')]
  44. #[Groups(['billperiod', 'billaccounting_list_billperiod', 'bill_list_billperiod', 'billpayment_list_bill', 'billcredit_list_billperiod', 'advancepayment_list_billperiod', 'build_bills_billperiod', 'billcredit_list_billperiod', 'advancepayment_list_billperiod'])]
  45. private $schoolYear;
  46. /**
  47. * @var \DateTime
  48. *
  49. * @Iri("https://schema.org/detailDateStart")
  50. */
  51. #[ORM\Column(type: 'date', nullable: true)]
  52. #[Assert\Date]
  53. #[Groups(['billperiod', 'build_bills_billperiod'])]
  54. private $detailDateStart;
  55. /**
  56. * @var \DateTime
  57. *
  58. * @Iri("https://schema.org/detailDateEnd")
  59. */
  60. #[ORM\Column(type: 'date', nullable: true)]
  61. #[Assert\Date]
  62. #[Groups(['billperiod'])]
  63. private $detailDateEnd;
  64. /**
  65. * @var
  66. */
  67. #[ORM\Column(type: 'string', nullable: true)]
  68. #[Assert\Type(type: 'string')]
  69. #[Assert\Choice(callback: ['\AppBundle\Enum\Billing\PeriodEnum', 'toArray'])]
  70. #[Groups(['billperiod', 'billaccounting_list_billperiod', 'bill_list_billperiod', 'billpayment_list_bill', 'billcredit_list_billperiod', 'build_bills_billperiod'])]
  71. private $detailLabel;
  72. /**
  73. * @var \DateTime
  74. */
  75. #[ORM\Column(type: 'date', nullable: true)]
  76. #[Assert\Date]
  77. #[Groups(['billperiod', 'build_bills_billperiod'])]
  78. private $uniqDate;
  79. /**
  80. * Constructor
  81. */
  82. public function __construct()
  83. {
  84. }
  85. /**
  86. * Sets id.
  87. *
  88. * @param int $id
  89. *
  90. * @return $this
  91. */
  92. public function setId($id)
  93. {
  94. $this->id = $id;
  95. return $this;
  96. }
  97. /**
  98. * Gets id.
  99. *
  100. * @return int
  101. */
  102. public function getId()
  103. {
  104. return $this->id;
  105. }
  106. /**
  107. * Set periodicity
  108. *
  109. * @param string $periodicity
  110. *
  111. * @return BillPeriod
  112. */
  113. public function setPeriodicity($periodicity)
  114. {
  115. $this->periodicity = $periodicity;
  116. return $this;
  117. }
  118. /**
  119. * Get periodicity
  120. *
  121. * @return string
  122. */
  123. public function getPeriodicity()
  124. {
  125. return $this->periodicity;
  126. }
  127. /**
  128. * Set schoolYear
  129. *
  130. * @param string $schoolYear
  131. *
  132. * @return BillPeriod
  133. */
  134. public function setSchoolYear($schoolYear)
  135. {
  136. $this->schoolYear = $schoolYear;
  137. return $this;
  138. }
  139. /**
  140. * Get schoolYear
  141. *
  142. * @return string
  143. */
  144. public function getSchoolYear()
  145. {
  146. return $this->schoolYear;
  147. }
  148. /**
  149. * Set detailDateStart
  150. *
  151. * @param \DateTime $detailDateStart
  152. *
  153. * @return BillPeriod
  154. */
  155. public function setDetailDateStart($detailDateStart)
  156. {
  157. $this->detailDateStart = $detailDateStart;
  158. return $this;
  159. }
  160. /**
  161. * Get detailDateStart
  162. *
  163. * @return \DateTime
  164. */
  165. public function getDetailDateStart()
  166. {
  167. return $this->detailDateStart ? $this->detailDateStart->format('Y-m-d') : $this->detailDateStart;
  168. }
  169. /**
  170. * Set detailDateEnd
  171. *
  172. * @param \DateTime $detailDateEnd
  173. *
  174. * @return BillPeriod
  175. */
  176. public function setDetailDateEnd($detailDateEnd)
  177. {
  178. $this->detailDateEnd = $detailDateEnd;
  179. return $this;
  180. }
  181. /**
  182. * Get detailDateEnd
  183. *
  184. * @return \DateTime
  185. */
  186. public function getDetailDateEnd()
  187. {
  188. return $this->detailDateEnd ? $this->detailDateEnd->format('Y-m-d') : $this->detailDateEnd;
  189. }
  190. /**
  191. * Set uniqDate
  192. *
  193. * @param \DateTime $uniqDate
  194. *
  195. * @return BillPeriod
  196. */
  197. public function setUniqDate($uniqDate)
  198. {
  199. $this->uniqDate = $uniqDate;
  200. return $this;
  201. }
  202. /**
  203. * Get uniqDate
  204. *
  205. * @return \DateTime
  206. */
  207. public function getUniqDate()
  208. {
  209. return $this->uniqDate ? $this->uniqDate->format('Y-m-d') : $this->uniqDate;
  210. }
  211. /**
  212. * Set detailLabel
  213. *
  214. * @param string $detailLabel
  215. *
  216. * @return BillPeriod
  217. */
  218. public function setDetailLabel($detailLabel)
  219. {
  220. $this->detailLabel = $detailLabel;
  221. return $this;
  222. }
  223. /**
  224. * Get detailLabel
  225. *
  226. * @return string
  227. */
  228. public function getDetailLabel()
  229. {
  230. return $this->detailLabel;
  231. }
  232. }