EducationalProject.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. <?php
  2. namespace AppBundle\Entity\Booking;
  3. use AppBundle\Entity\AccessAndFunction\Access;
  4. use AppBundle\Entity\Billing\EducationalProjectIntangible;
  5. use AppBundle\Entity\Product\Equipment;
  6. use Doctrine\Common\Collections\ArrayCollection;
  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\Validator\Constraints\Booking as OpentalentEvent;
  12. /**
  13. * Prestation pédagogique
  14. *
  15. * @Iri("http://schema.org/EducationalProject")
  16. * @OpentalentEvent\EducationnalProject()
  17. */
  18. #[ORM\Entity(repositoryClass: 'AppBundle\Entity\Booking\Repository\EducationalProjectRepository')]
  19. class EducationalProject extends AbstractBooking
  20. {
  21. /**
  22. * @var ArrayCollection<EducationalProjectRecur>
  23. */
  24. #[Assert\Valid]
  25. #[ORM\OneToMany(targetEntity: 'EducationalProjectRecur', mappedBy: 'event', cascade: ['persist'], orphanRemoval: true)]
  26. #[Groups(['educationalproject_bookingrecur', 'planning_detail'])]
  27. protected $eventRecur;
  28. /**
  29. * @var ArrayCollection<EducationalProject>
  30. */
  31. #[ORM\OneToMany(targetEntity: 'EducationalProject', mappedBy: 'parent', orphanRemoval: true)]
  32. #[Groups(['educationalproject_timeline'])]
  33. private $timeline;
  34. /**
  35. * @var \AppBundle\Entity\Booking\EducationalProject
  36. */
  37. #[ORM\ManyToOne(targetEntity: 'EducationalProject', inversedBy: 'timeline')]
  38. #[Groups(['educationalproject'])]
  39. private $parent;
  40. /**
  41. * @var string
  42. */
  43. #[Assert\Type(type: 'string')]
  44. #[Assert\Choice(callback: ['\AppBundle\Enum\Booking\EducationalProjectTimelineTypeEnum', 'toArray'], multiple: false, min: 1)]
  45. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  46. #[Groups(['educationalproject'])]
  47. private $type;
  48. /**
  49. * @var string
  50. */
  51. #[ORM\Column(type: 'string', length: 35, nullable: true)]
  52. #[Assert\Type(type: 'string')]
  53. #[Groups(['educationalproject', 'planning_detail', 'educationalproject_details'])]
  54. private $object;
  55. /**
  56. * @var Access
  57. */
  58. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'silentPartners')]
  59. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  60. #[Groups(['educationalproject', 'planning_detail', 'educationalproject_details'])]
  61. private $silentPartner;
  62. /**
  63. * @var EducationalProjectPublic
  64. */
  65. #[ORM\ManyToOne(targetEntity: 'EducationalProjectPublic', inversedBy: 'educationalProjects')]
  66. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  67. #[Groups(['educationalproject', 'planning_detail', 'educationalproject_details'])]
  68. private $public;
  69. /**
  70. * @var float
  71. */
  72. #[ORM\Column(type: 'float', nullable: true)]
  73. #[Assert\Type(type: 'float')]
  74. #[Groups(['educationalproject', 'planning_detail', 'educationalproject_details'])]
  75. private $amount;
  76. /**
  77. * @var EducationalProjectAge
  78. */
  79. #[Assert\Valid]
  80. #[ORM\OneToOne(targetEntity: 'EducationalProjectAge', cascade: ['persist'], orphanRemoval: true, fetch: 'EAGER')]
  81. #[ORM\JoinColumn(nullable: true)]
  82. #[Groups(['educationalproject', 'educationalproject_details', 'planning_detail'])]
  83. private $ageDistribution;
  84. /**
  85. * @var Access
  86. */
  87. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'operationalPartners')]
  88. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  89. #[Groups(['educationalproject', 'planning_detail', 'educationalproject_details'])]
  90. private $operationalPartner;
  91. /**
  92. * @var Access
  93. */
  94. #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access')]
  95. #[ORM\JoinTable(name: 'educationalproject_financier')]
  96. #[Groups(['educationalproject_access', 'planning_detail', 'educationalproject_details'])]
  97. private $financiers;
  98. /**
  99. * @var string
  100. */
  101. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  102. #[Assert\Type(type: 'string')]
  103. #[Assert\Choice(callback: ['\AppBundle\Enum\Booking\EducationalProjectEstablishmentEnum', 'toArray'])]
  104. #[Groups(['educationalproject', 'planning_detail', 'educationalproject_details'])]
  105. private $establishment;
  106. /**
  107. * @var string
  108. */
  109. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  110. #[Assert\Type(type: 'string')]
  111. #[Assert\Choice(callback: ['\AppBundle\Enum\Booking\EducationalProjectSpecialClassEnum', 'toArray'])]
  112. #[Groups(['educationalproject', 'planning_detail', 'educationalproject_details'])]
  113. private $specialClass;
  114. /**
  115. * @var string
  116. */
  117. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  118. #[Assert\Type(type: 'string')]
  119. #[Assert\Choice(callback: ['\AppBundle\Enum\Booking\EducationalProjectEducationalDeviceEnum', 'toArray'])]
  120. #[Groups(['educationalproject', 'planning_detail', 'educationalproject_details'])]
  121. private $educationalDevice;
  122. /**
  123. * @var string
  124. */
  125. #[ORM\Column(type: 'text', nullable: true)]
  126. #[Assert\Type(type: 'string')]
  127. #[Groups(['educationalproject', 'planning_detail'])]
  128. private $report;
  129. /**
  130. * @var ArrayCollection<File>
  131. */
  132. #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\File')]
  133. #[Groups(['educationalproject_file'])]
  134. private $files;
  135. /**
  136. * @var ArrayCollection<EducationalProjectIntangible>
  137. */
  138. #[Assert\Valid]
  139. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Billing\EducationalProjectIntangible', mappedBy: 'educationalProject', cascade: ['persist'], orphanRemoval: true)]
  140. #[Groups(['educationalprojects_educationalprojectintangible', 'planning_detail', 'educationalproject_details'])]
  141. private $educationalProjectIntangibles;
  142. /**
  143. * @var ArrayCollection<EducationalProject>
  144. */
  145. #[Assert\Valid]
  146. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Billing\EducationalProjectPayer', mappedBy: 'educationalProjectReceiver', cascade: ['persist'], orphanRemoval: true)]
  147. #[Groups(['educationalproject_educationalprojectpayer', 'planning_detail', 'educationalproject_details'])]
  148. private $billingReceivers;
  149. /**
  150. * @var ArrayCollection<BillLine>
  151. */
  152. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Billing\BillLine', mappedBy: 'educationalProject', orphanRemoval: true)]
  153. #[Groups(['educationalproject_billline', 'planning_detail'])]
  154. private $billLines;
  155. /**
  156. * var ArrayCollection<AttendanceBooking>
  157. */
  158. #[Assert\Valid]
  159. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Booking\AttendanceBooking', cascade: ['persist'], mappedBy: 'educationalProject', orphanRemoval: true)]
  160. #[ORM\JoinColumn(nullable: false)]
  161. #[Groups(['educationalproject_attendancebooking', 'educationalproject_details', 'planning_detail'])]
  162. private $attendanceBooking;
  163. public function __construct()
  164. {
  165. parent::__construct();
  166. $this->files = new ArrayCollection();
  167. $this->financiers = new ArrayCollection();
  168. $this->educationalProjectIntangibles = new ArrayCollection();
  169. $this->billingReceivers = new ArrayCollection();
  170. $this->attendanceBooking = new ArrayCollection();
  171. }
  172. /**
  173. * Sets object.
  174. *
  175. * @param string $object
  176. *
  177. * @return $this
  178. */
  179. public function setObject($object)
  180. {
  181. $this->object = $object;
  182. return $this;
  183. }
  184. /**
  185. * Gets object.
  186. *
  187. * @return string
  188. */
  189. public function getObject()
  190. {
  191. return $this->object;
  192. }
  193. /**
  194. * Sets public.
  195. *
  196. * @param EducationalProjectPublic $educationalProjectPublic
  197. *
  198. * @return $this
  199. */
  200. public function setPublic(EducationalProjectPublic $public = null)
  201. {
  202. $this->public = $public;
  203. return $this;
  204. }
  205. /**
  206. * Gets public.
  207. *
  208. * @return EducationalProjectPublic
  209. */
  210. public function getPublic()
  211. {
  212. return $this->public;
  213. }
  214. /**
  215. * Sets amount.
  216. *
  217. * @param float $amount
  218. *
  219. * @return $this
  220. */
  221. public function setAmount($amount)
  222. {
  223. $this->amount = floatval($amount);
  224. return $this;
  225. }
  226. /**
  227. * Gets amount.
  228. *
  229. * @return float
  230. */
  231. public function getAmount()
  232. {
  233. return $this->amount;
  234. }
  235. /**
  236. * Sets establishment.
  237. *
  238. * @param string $establishment
  239. *
  240. * @return $this
  241. */
  242. public function setEstablishment($establishment)
  243. {
  244. $this->establishment = $establishment;
  245. return $this;
  246. }
  247. /**
  248. * Gets establishment.
  249. *
  250. * @return string
  251. */
  252. public function getEstablishment()
  253. {
  254. return $this->establishment;
  255. }
  256. /**
  257. * Sets specialClass.
  258. *
  259. * @param string $specialClass
  260. *
  261. * @return $this
  262. */
  263. public function setSpecialClass($specialClass)
  264. {
  265. $this->specialClass = $specialClass;
  266. return $this;
  267. }
  268. /**
  269. * Gets specialClass.
  270. *
  271. * @return string
  272. */
  273. public function getSpecialClass()
  274. {
  275. return $this->specialClass;
  276. }
  277. /**
  278. * Sets educationalDevice.
  279. *
  280. * @param string $educationalDevice
  281. *
  282. * @return $this
  283. */
  284. public function setEducationalDevice($educationalDevice)
  285. {
  286. $this->educationalDevice = $educationalDevice;
  287. return $this;
  288. }
  289. /**
  290. * Gets educationalDevice.
  291. *
  292. * @return string
  293. */
  294. public function getEducationalDevice()
  295. {
  296. return $this->educationalDevice;
  297. }
  298. /**
  299. * Sets report.
  300. *
  301. * @param string $report
  302. *
  303. * @return $this
  304. */
  305. public function setReport($report)
  306. {
  307. $this->report = $report;
  308. return $this;
  309. }
  310. /**
  311. * Gets report.
  312. *
  313. * @return string
  314. */
  315. public function getReport()
  316. {
  317. return $this->report;
  318. }
  319. /**
  320. * Set ageDistribution
  321. *
  322. * @param \AppBundle\Entity\Booking\EducationalProjectAge $ageDistribution
  323. *
  324. * @return EducationalProject
  325. */
  326. public function setAgeDistribution(\AppBundle\Entity\Booking\EducationalProjectAge $ageDistribution = null)
  327. {
  328. $this->ageDistribution = $ageDistribution;
  329. return $this;
  330. }
  331. /**
  332. * Get ageDistribution
  333. *
  334. * @return \AppBundle\Entity\Booking\EducationalProjectAge
  335. */
  336. public function getAgeDistribution()
  337. {
  338. return $this->ageDistribution;
  339. }
  340. /**
  341. * Add file
  342. *
  343. * @param \AppBundle\Entity\Core\File $file
  344. *
  345. * @return EducationalProject
  346. */
  347. public function addFile(\AppBundle\Entity\Core\File $file)
  348. {
  349. $this->files[] = $file;
  350. return $this;
  351. }
  352. /**
  353. * Remove file
  354. *
  355. * @param \AppBundle\Entity\Core\File $file
  356. */
  357. public function removeFile(\AppBundle\Entity\Core\File $file)
  358. {
  359. $this->files->removeElement($file);
  360. }
  361. /**
  362. * Get files
  363. *
  364. * @return \Doctrine\Common\Collections\Collection
  365. */
  366. public function getFiles()
  367. {
  368. return $this->files;
  369. }
  370. /**
  371. * Set silentPartner
  372. *
  373. * @param \AppBundle\Entity\AccessAndFunction\Access $silentPartner
  374. *
  375. * @return EducationalProject
  376. */
  377. public function setSilentPartner(\AppBundle\Entity\AccessAndFunction\Access $silentPartner = null)
  378. {
  379. $this->silentPartner = $silentPartner;
  380. return $this;
  381. }
  382. /**
  383. * Get silentPartner
  384. *
  385. * @return \AppBundle\Entity\AccessAndFunction\Access
  386. */
  387. public function getSilentPartner()
  388. {
  389. return $this->silentPartner;
  390. }
  391. /**
  392. * Set operationalPartner
  393. *
  394. * @param \AppBundle\Entity\AccessAndFunction\Access $operationalPartner
  395. *
  396. * @return EducationalProject
  397. */
  398. public function setOperationalPartner(\AppBundle\Entity\AccessAndFunction\Access $operationalPartner = null)
  399. {
  400. $this->operationalPartner = $operationalPartner;
  401. return $this;
  402. }
  403. /**
  404. * Get operationalPartner
  405. *
  406. * @return \AppBundle\Entity\AccessAndFunction\Access
  407. */
  408. public function getOperationalPartner()
  409. {
  410. return $this->operationalPartner;
  411. }
  412. /**
  413. * Add financier
  414. *
  415. * @param \AppBundle\Entity\AccessAndFunction\Access $financier
  416. *
  417. * @return EducationalProject
  418. */
  419. public function addFinancier(\AppBundle\Entity\AccessAndFunction\Access $financier)
  420. {
  421. $this->financiers[] = $financier;
  422. return $this;
  423. }
  424. /**
  425. * Remove financier
  426. *
  427. * @param \AppBundle\Entity\AccessAndFunction\Access $financier
  428. */
  429. public function removeFinancier(\AppBundle\Entity\AccessAndFunction\Access $financier)
  430. {
  431. $this->financiers->removeElement($financier);
  432. }
  433. /**
  434. * Get financiers
  435. *
  436. * @return \Doctrine\Common\Collections\Collection
  437. */
  438. public function getFinanciers()
  439. {
  440. return $this->financiers;
  441. }
  442. /**
  443. * {@inheritdoc}
  444. */
  445. public function getParticipants() {
  446. $participants = new ArrayCollection();
  447. return $participants;
  448. }
  449. /**
  450. * Set type
  451. *
  452. * @param string $type
  453. *
  454. * @return EducationalProject
  455. */
  456. public function setType($type)
  457. {
  458. $this->type = $type;
  459. return $this;
  460. }
  461. /**
  462. * Get type
  463. *
  464. * @return string
  465. */
  466. public function getType()
  467. {
  468. return $this->type;
  469. }
  470. /**
  471. * Add timeline
  472. *
  473. * @param \AppBundle\Entity\Booking\EducationalProject $timeline
  474. *
  475. * @return EducationalProject
  476. */
  477. public function addTimeline(\AppBundle\Entity\Booking\EducationalProject $timeline)
  478. {
  479. $this->timeline[] = $timeline;
  480. return $this;
  481. }
  482. /**
  483. * Remove timeline
  484. *
  485. * @param \AppBundle\Entity\Booking\EducationalProject $timeline
  486. */
  487. public function removeTimeline(\AppBundle\Entity\Booking\EducationalProject $timeline)
  488. {
  489. $this->timeline->removeElement($timeline);
  490. }
  491. /**
  492. * Get timeline
  493. *
  494. * @return \Doctrine\Common\Collections\Collection
  495. */
  496. public function getTimeline()
  497. {
  498. return $this->timeline;
  499. }
  500. /**
  501. * Set parent
  502. *
  503. * @param \AppBundle\Entity\Booking\EducationalProject $parent
  504. *
  505. * @return EducationalProject
  506. */
  507. public function setParent(\AppBundle\Entity\Booking\EducationalProject $parent = null)
  508. {
  509. $this->parent = $parent;
  510. return $this;
  511. }
  512. /**
  513. * Get parent
  514. *
  515. * @return \AppBundle\Entity\Booking\EducationalProject
  516. */
  517. public function getParent()
  518. {
  519. return $this->parent;
  520. }
  521. /**
  522. * Add educationalProjectIntangible
  523. *
  524. * @param \AppBundle\Entity\Billing\EducationalProjectIntangible $educationalProjectIntangible
  525. *
  526. * @return EducationalProject
  527. */
  528. public function addEducationalProjectIntangible(\AppBundle\Entity\Billing\EducationalProjectIntangible $educationalProjectIntangible)
  529. {
  530. $educationalProjectIntangible->setEducationalProject($this);
  531. $this->educationalProjectIntangibles[] = $educationalProjectIntangible;
  532. return $this;
  533. }
  534. /**
  535. * Remove educationalProjectIntangible
  536. *
  537. * @param \AppBundle\Entity\Billing\EducationalProjectIntangible $educationalProjectIntangible
  538. */
  539. public function removeEducationalProjectIntangible(\AppBundle\Entity\Billing\EducationalProjectIntangible $educationalProjectIntangible)
  540. {
  541. $educationalProjectIntangible->setEducationalProject(null);
  542. $this->educationalProjectIntangibles->removeElement($educationalProjectIntangible);
  543. }
  544. /**
  545. * Get educationalProjectIntangibles
  546. *
  547. * @return \Doctrine\Common\Collections\Collection
  548. */
  549. public function getEducationalProjectIntangibles()
  550. {
  551. return $this->educationalProjectIntangibles;
  552. }
  553. /**
  554. * Add billingReceiver
  555. *
  556. * @param \AppBundle\Entity\Billing\EducationalProjectPayer $billingReceiver
  557. *
  558. * @return EducationalProject
  559. */
  560. public function addBillingReceiver(\AppBundle\Entity\Billing\EducationalProjectPayer $billingReceiver)
  561. {
  562. $billingReceiver->setEducationalProjectReceiver($this);
  563. $this->billingReceivers[] = $billingReceiver;
  564. return $this;
  565. }
  566. /**
  567. * Remove billingReceiver
  568. *
  569. * @param \AppBundle\Entity\Billing\EducationalProjectPayer $billingReceiver
  570. */
  571. public function removeBillingReceiver(\AppBundle\Entity\Billing\EducationalProjectPayer $billingReceiver)
  572. {
  573. $this->billingReceivers->removeElement($billingReceiver);
  574. }
  575. /**
  576. * Get billingReceivers
  577. *
  578. * @return \Doctrine\Common\Collections\Collection
  579. */
  580. public function getBillingReceivers()
  581. {
  582. return $this->billingReceivers;
  583. }
  584. /**
  585. * Add billLine
  586. *
  587. * @param \AppBundle\Entity\Billing\BillLine $billLine
  588. *
  589. * @return EducationalProject
  590. */
  591. public function addBillLine(\AppBundle\Entity\Billing\BillLine $billLine)
  592. {
  593. $this->billLines[] = $billLine;
  594. return $this;
  595. }
  596. /**
  597. * Remove billLine
  598. *
  599. * @param \AppBundle\Entity\Billing\BillLine $billLine
  600. */
  601. public function removeBillLine(\AppBundle\Entity\Billing\BillLine $billLine)
  602. {
  603. $this->billLines->removeElement($billLine);
  604. }
  605. /**
  606. * Get billLines
  607. *
  608. * @return \Doctrine\Common\Collections\Collection
  609. */
  610. public function getBillLines()
  611. {
  612. return $this->billLines;
  613. }
  614. /**
  615. * Add attendanceBooking
  616. *
  617. * @param \AppBundle\Entity\Booking\AttendanceBooking $attendanceBooking
  618. *
  619. * @return AbstractBooking
  620. */
  621. public function addAttendanceBooking(\AppBundle\Entity\Booking\AttendanceBooking $attendanceBooking)
  622. {
  623. $attendanceBooking->setEducationalProject($this);
  624. $this->attendanceBooking[] = $attendanceBooking;
  625. return $this;
  626. }
  627. /**
  628. * Remove attendanceBooking
  629. *
  630. * @param \AppBundle\Entity\Booking\AttendanceBooking $attendanceBooking
  631. */
  632. public function removeAttendanceBooking(\AppBundle\Entity\Booking\AttendanceBooking $attendanceBooking)
  633. {
  634. $this->attendanceBooking->removeElement($attendanceBooking);
  635. }
  636. /**
  637. * Get attendanceBooking
  638. *
  639. * @return \Doctrine\Common\Collections\Collection
  640. */
  641. public function getAttendanceBooking()
  642. {
  643. return $this->attendanceBooking;
  644. }
  645. }