Pes.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <?php
  2. namespace AppBundle\Entity\Billing;
  3. use AppBundle\Entity\AccessAndFunction\Access;
  4. use AppBundle\Entity\Booking\EducationalProject;
  5. use AppBundle\Entity\Core\File;
  6. use AppBundle\Entity\Product\EquipmentLoan;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Dunglas\ApiBundle\Annotation\Iri;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. use AppBundle\Entity\Traits\TimestampableEntity;
  12. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  13. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  14. use Doctrine\Common\Collections\ArrayCollection;
  15. /**
  16. * Paramètres généraux d'un export PES
  17. * NB: PES est un format de données demandé par le Trésor Public pour l'export des données comptables
  18. *
  19. * @Iri("http://schema.org/Pes")
  20. */
  21. #[ORM\Entity]
  22. class Pes
  23. {
  24. use TimestampableEntity;
  25. use CreatorUpdaterEntity;
  26. /**
  27. * @var int
  28. */
  29. #[ORM\Column(type: 'integer')]
  30. #[ORM\Id]
  31. #[ORM\GeneratedValue(strategy: 'AUTO')]
  32. #[Groups(['pes', 'pes_list', 'billaccounting_list'])]
  33. private $id;
  34. /**
  35. * @var ArrayCollection<Bill>
  36. */
  37. #[ORM\OneToMany(targetEntity: 'Bill', mappedBy: 'pes', cascade: ['persist'], orphanRemoval: true)]
  38. #[Groups(['pes_bills'])]
  39. private $bills;
  40. /**
  41. * @var string
  42. */
  43. #[ORM\Column(type: 'string', nullable: true)]
  44. #[Assert\Type(type: 'string')]
  45. #[Groups(['pes', 'pes_list', 'billaccounting_list_pes'])]
  46. private $roleNumber;
  47. /**
  48. * @var \DateTime
  49. */
  50. #[ORM\Column(type: 'date', nullable: true)]
  51. #[Assert\Date]
  52. #[Groups(['pes', 'pes_list'])]
  53. private $date;
  54. /**
  55. * @var File
  56. */
  57. #[Assert\Valid]
  58. #[ORM\OneToOne(targetEntity: 'AppBundle\Entity\Core\File', cascade: ['persist'], fetch: 'EAGER')]
  59. #[ORM\JoinColumn(nullable: true)]
  60. #[Groups(['pes', 'pes_list'])]
  61. private $file;
  62. /**
  63. * @var \DateTime
  64. */
  65. #[ORM\Column(type: 'date', nullable: true)]
  66. #[Assert\Date]
  67. #[Groups(['pes', 'pes_list'])]
  68. private $samplingDate;
  69. /**
  70. * @var bool
  71. */
  72. #[ORM\Column(type: 'boolean', options: ['default' => false])]
  73. #[Assert\Type(type: 'boolean')]
  74. #[Groups(['pes', 'pes_list'])]
  75. #[Assert\NotNull]
  76. private $withSampling = false;
  77. /**
  78. * The constructor
  79. */
  80. public function __construct() {
  81. $this->bills = new ArrayCollection();
  82. }
  83. /**
  84. * Sets id.
  85. *
  86. * @param int $id
  87. *
  88. * @return $this
  89. */
  90. public function setId($id)
  91. {
  92. $this->id = $id;
  93. return $this;
  94. }
  95. /**
  96. * Gets id.
  97. *
  98. * @return int
  99. */
  100. public function getId()
  101. {
  102. return $this->id;
  103. }
  104. /**
  105. * Set roleNumber
  106. *
  107. * @param string $roleNumber
  108. *
  109. * @return Pes
  110. */
  111. public function setRoleNumber($roleNumber)
  112. {
  113. $this->roleNumber = $roleNumber;
  114. return $this;
  115. }
  116. /**
  117. * Get roleNumber
  118. *
  119. * @return string
  120. */
  121. public function getRoleNumber()
  122. {
  123. return $this->roleNumber;
  124. }
  125. /**
  126. * Set date
  127. *
  128. * @param \DateTime $date
  129. *
  130. * @return Pes
  131. */
  132. public function setDate($date)
  133. {
  134. $this->date = $date;
  135. return $this;
  136. }
  137. /**
  138. * Get date
  139. *
  140. * @return \DateTime
  141. */
  142. public function getDate()
  143. {
  144. return $this->date;
  145. }
  146. /**
  147. * Set file
  148. *
  149. * @param \AppBundle\Entity\Core\File $file
  150. *
  151. * @return Pes
  152. */
  153. public function setFile(\AppBundle\Entity\Core\File $file = null)
  154. {
  155. $this->file = $file;
  156. return $this;
  157. }
  158. /**
  159. * Get file
  160. *
  161. * @return \AppBundle\Entity\Core\File
  162. */
  163. public function getFile()
  164. {
  165. return $this->file;
  166. }
  167. /**
  168. * Add bill
  169. *
  170. * @param \AppBundle\Entity\Billing\Bill $bill
  171. *
  172. * @return Pes
  173. */
  174. public function addBill(\AppBundle\Entity\Billing\Bill $bill)
  175. {
  176. $this->bills[] = $bill;
  177. return $this;
  178. }
  179. /**
  180. * Remove bill
  181. *
  182. * @param \AppBundle\Entity\Billing\Bill $bill
  183. */
  184. public function removeBill(\AppBundle\Entity\Billing\Bill $bill)
  185. {
  186. $this->bills->removeElement($bill);
  187. }
  188. /**
  189. * Get bills
  190. *
  191. * @return \Doctrine\Common\Collections\Collection
  192. */
  193. public function getBills()
  194. {
  195. return $this->bills;
  196. }
  197. /**
  198. * Set samplingDate
  199. *
  200. * @param \DateTime $samplingDate
  201. *
  202. * @return Pes
  203. */
  204. public function setSamplingDate($samplingDate)
  205. {
  206. $this->samplingDate = $samplingDate;
  207. return $this;
  208. }
  209. /**
  210. * Get samplingDate
  211. *
  212. * @return \DateTime
  213. */
  214. public function getSamplingDate()
  215. {
  216. return $this->samplingDate;
  217. }
  218. /**
  219. * Set withSampling
  220. *
  221. * @param boolean $withSampling
  222. *
  223. * @return Pes
  224. */
  225. public function setWithSampling($withSampling)
  226. {
  227. $this->withSampling = $withSampling;
  228. return $this;
  229. }
  230. /**
  231. * Get withSampling
  232. *
  233. * @return boolean
  234. */
  235. public function getWithSampling()
  236. {
  237. return $this->withSampling;
  238. }
  239. }