Intangible.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. <?php
  2. namespace AppBundle\Entity\Product;
  3. use AppBundle\Entity\Billing\AccessIntangible;
  4. use AppBundle\Entity\Billing\EducationalProjectIntangible;
  5. use AppBundle\Entity\Education\EducationCurriculum;
  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 OpentalentEventAssert;
  12. /**
  13. * Service ou produit à facturer (cours)
  14. *
  15. * @Iri("http://schema.org/Intangible")
  16. */
  17. #[ORM\Entity]
  18. class Intangible extends AbstractProduct
  19. {
  20. /**
  21. * @var string
  22. */
  23. #[ORM\Column(type: 'string', length: 100, nullable: false)]
  24. #[Assert\NotNull]
  25. #[Assert\Type(type: 'string')]
  26. #[Groups(['intangible', 'access_details_accessintangibles', 'educational_project_intangible_list', 'access_intangible_list', 'intangible_list', 'educationalproject_details_educationalprojectintangibles', 'access_intangible_list_intangible'])]
  27. private $label;
  28. /**
  29. * @var string
  30. */
  31. #[ORM\Column(type: 'string', nullable: true)]
  32. #[Assert\Type(type: 'string')]
  33. #[Assert\Choice(callback: ['\AppBundle\Enum\Billing\PeriodicityTypeEnum', 'toArray'])]
  34. #[Groups(['intangible', 'educational_project_intangible_list', 'access_intangible_list', 'intangible_list', 'access_intangible_list_intangible'])]
  35. private $billingPeriodicityType;
  36. /**
  37. * @var string
  38. */
  39. #[ORM\Column(type: 'string', nullable: true)]
  40. #[Assert\Type(type: 'string')]
  41. #[Assert\Choice(callback: ['\AppBundle\Enum\Billing\PeriodicityEnum', 'toArray'])]
  42. #[Groups(['intangible', 'educational_project_intangible_list', 'access_intangible_list', 'intangible_list', 'access_intangible_list_intangible'])]
  43. private $billingPeriodicity;
  44. /**
  45. * @var bool
  46. */
  47. #[ORM\Column(type: 'boolean', options: ['default' => true])]
  48. #[Assert\Type(type: 'boolean')]
  49. #[Assert\NotNull]
  50. #[Groups(['intangible', 'educational_project_intangible_list', 'access_intangible_list', 'intangible_list', 'access_intangible_list_intangible'])]
  51. private $isActive = true;
  52. /**
  53. * @var \DateTime
  54. */
  55. #[ORM\Column(type: 'datetime', nullable: true)]
  56. #[Assert\DateTime]
  57. #[Groups(['intangible'])]
  58. private $archiveDate;
  59. /**
  60. * @var string
  61. */
  62. #[ORM\Column(type: 'string', length: 7, nullable: true)]
  63. #[Assert\Length(max: 7, maxMessage: 'invalid-max-length')]
  64. #[Assert\Type(type: 'string')]
  65. #[Groups(['intangible', 'intangible_list', 'access_intangible_list_intangible'])]
  66. private $accountingCode;
  67. /**
  68. * @var int
  69. */
  70. #[ORM\Column(type: 'integer', nullable: true)]
  71. #[Assert\Type(type: 'integer', message: 'invalid-integer')]
  72. #[Groups(['intangible', 'intangible_list', 'access_intangible_list_intangible'])]
  73. private $nature;
  74. /**
  75. * @var string
  76. */
  77. #[ORM\Column(type: 'string', length: 200, nullable: true)]
  78. #[Assert\Type(type: 'string')]
  79. #[Groups(['intangible', 'intangible_list', 'access_intangible_list_intangible'])]
  80. private $accountingCodelabel;
  81. /**
  82. * @var bool
  83. */
  84. #[ORM\Column(type: 'boolean', options: ['default' => true])]
  85. #[Assert\Type(type: 'boolean')]
  86. #[Assert\NotNull]
  87. #[Groups(['intangible', 'access_intangible_list_intangible'])]
  88. private $applyVat = true;
  89. /**
  90. * @var float
  91. */
  92. #[ORM\Column(type: 'float', nullable: true)]
  93. #[Assert\Type(type: 'float')]
  94. #[Groups(['intangible', 'intangible_list', 'access_intangible_list_intangible'])]
  95. private $amountVat;
  96. /**
  97. * @var EducationCurriculum
  98. */
  99. #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Education\EducationCurriculum')]
  100. #[ORM\JoinTable]
  101. #[Groups(['intangible_educationcurriculum', 'intangible_list', 'access_intangible_list_intangible'])]
  102. private $educationCurriculums;
  103. /**
  104. * @var IntangiblePriceAndDiscount
  105. */
  106. #[Assert\Valid]
  107. #[ORM\OneToOne(targetEntity: 'IntangiblePriceAndDiscount', cascade: ['persist'], orphanRemoval: true, fetch: 'EAGER')]
  108. #[ORM\JoinColumn(nullable: true)]
  109. #[Groups(['intangible', 'educational_project_intangible_list', 'access_intangible_list', 'intangible_list', 'access_intangible_list_intangible'])]
  110. private $intangiblePriceAndDiscount;
  111. /**
  112. * @var string
  113. */
  114. #[ORM\Column(type: 'string', nullable: true)]
  115. #[Assert\Type(type: 'string')]
  116. #[Assert\Choice(callback: ['\AppBundle\Enum\Education\EducationTypeEnum', 'toArray'])]
  117. #[Groups(['intangible'])]
  118. private $domain;
  119. /**
  120. * @var ArrayCollection<AccessIntangible>
  121. */
  122. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Billing\AccessIntangible', mappedBy: 'intangible', orphanRemoval: true, cascade: ['persist'])]
  123. #[Groups(['intangible_accessintangible'])]
  124. private $accessIntangibles;
  125. public function __construct()
  126. {
  127. parent::__construct();
  128. $this->educationCurriculums = new ArrayCollection();
  129. }
  130. /**
  131. * Set label
  132. *
  133. * @param string $label
  134. *
  135. * @return Intangible
  136. */
  137. public function setLabel($label)
  138. {
  139. $this->label = $label;
  140. return $this;
  141. }
  142. /**
  143. * Get label
  144. *
  145. * @return string
  146. */
  147. public function getLabel()
  148. {
  149. return $this->label;
  150. }
  151. /**
  152. * Set billingPeriodicity
  153. *
  154. * @param string $billingPeriodicity
  155. *
  156. * @return Intangible
  157. */
  158. public function setBillingPeriodicity($billingPeriodicity)
  159. {
  160. $this->billingPeriodicity = $billingPeriodicity;
  161. return $this;
  162. }
  163. /**
  164. * Get billingPeriodicity
  165. *
  166. * @return string
  167. */
  168. public function getBillingPeriodicity()
  169. {
  170. return $this->billingPeriodicity;
  171. }
  172. /**
  173. * Set isActive
  174. *
  175. * @param boolean $isActive
  176. *
  177. * @return Intangible
  178. */
  179. public function setIsActive($isActive)
  180. {
  181. $this->isActive = $isActive;
  182. return $this;
  183. }
  184. /**
  185. * Get isActive
  186. *
  187. * @return boolean
  188. */
  189. public function getIsActive()
  190. {
  191. return $this->isActive;
  192. }
  193. /**
  194. * Set archiveDate
  195. *
  196. * @param \DateTime $archiveDate
  197. *
  198. * @return Intangible
  199. */
  200. public function setArchiveDate($archiveDate)
  201. {
  202. $this->archiveDate = $archiveDate;
  203. return $this;
  204. }
  205. /**
  206. * Get archiveDate
  207. *
  208. * @return \DateTime
  209. */
  210. public function getArchiveDate()
  211. {
  212. return $this->archiveDate;
  213. }
  214. /**
  215. * Set accountingCode
  216. *
  217. * @param integer $accountingCode
  218. *
  219. * @return Intangible
  220. */
  221. public function setAccountingCode($accountingCode)
  222. {
  223. $this->accountingCode = $accountingCode;
  224. return $this;
  225. }
  226. /**
  227. * Get accountingCode
  228. *
  229. * @return integer
  230. */
  231. public function getAccountingCode()
  232. {
  233. return $this->accountingCode;
  234. }
  235. /**
  236. * Set nature
  237. *
  238. * @param integer $nature
  239. *
  240. * @return Intangible
  241. */
  242. public function setNature($nature)
  243. {
  244. $this->nature = $nature;
  245. return $this;
  246. }
  247. /**
  248. * Get nature
  249. *
  250. * @return integer
  251. */
  252. public function getNature()
  253. {
  254. return $this->nature;
  255. }
  256. /**
  257. * Set accountingCodelabel
  258. *
  259. * @param string $accountingCodelabel
  260. *
  261. * @return Intangible
  262. */
  263. public function setAccountingCodelabel($accountingCodelabel)
  264. {
  265. $this->accountingCodelabel = $accountingCodelabel;
  266. return $this;
  267. }
  268. /**
  269. * Get accountingCodelabel
  270. *
  271. * @return string
  272. */
  273. public function getAccountingCodelabel()
  274. {
  275. return $this->accountingCodelabel;
  276. }
  277. /**
  278. * Set applyVat
  279. *
  280. * @param boolean $applyVat
  281. *
  282. * @return Intangible
  283. */
  284. public function setApplyVat($applyVat)
  285. {
  286. $this->applyVat = $applyVat;
  287. return $this;
  288. }
  289. /**
  290. * Get applyVat
  291. *
  292. * @return boolean
  293. */
  294. public function getApplyVat()
  295. {
  296. return $this->applyVat;
  297. }
  298. /**
  299. * Set amountVat
  300. *
  301. * @param float $amountVat
  302. *
  303. * @return Intangible
  304. */
  305. public function setAmountVat($amountVat)
  306. {
  307. $this->amountVat = floatval($amountVat);
  308. return $this;
  309. }
  310. /**
  311. * Get amountVat
  312. *
  313. * @return float
  314. */
  315. public function getAmountVat()
  316. {
  317. return $this->amountVat;
  318. }
  319. /**
  320. * Set intangiblePriceAndDiscount
  321. *
  322. * @param \AppBundle\Entity\Product\IntangiblePriceAndDiscount $intangiblePriceAndDiscount
  323. *
  324. * @return Intangible
  325. */
  326. public function setIntangiblePriceAndDiscount(\AppBundle\Entity\Product\IntangiblePriceAndDiscount $intangiblePriceAndDiscount = null)
  327. {
  328. $this->intangiblePriceAndDiscount = $intangiblePriceAndDiscount;
  329. return $this;
  330. }
  331. /**
  332. * Get intangiblePriceAndDiscount
  333. *
  334. * @return \AppBundle\Entity\Product\IntangiblePriceAndDiscount
  335. */
  336. public function getIntangiblePriceAndDiscount()
  337. {
  338. return $this->intangiblePriceAndDiscount;
  339. }
  340. /**
  341. * Set billingPeriodicityType
  342. *
  343. * @param string $billingPeriodicityType
  344. *
  345. * @return Intangible
  346. */
  347. public function setBillingPeriodicityType($billingPeriodicityType)
  348. {
  349. $this->billingPeriodicityType = $billingPeriodicityType;
  350. return $this;
  351. }
  352. /**
  353. * Get billingPeriodicityType
  354. *
  355. * @return string
  356. */
  357. public function getBillingPeriodicityType()
  358. {
  359. return $this->billingPeriodicityType;
  360. }
  361. /**
  362. * Add educationalProjectIntangible
  363. *
  364. * @param \AppBundle\Entity\Billing\EducationalProjectIntangible $educationalProjectIntangible
  365. *
  366. * @return Intangible
  367. */
  368. public function addEducationalProjectIntangible(\AppBundle\Entity\Billing\EducationalProjectIntangible $educationalProjectIntangible)
  369. {
  370. $this->educationalProjectIntangible[] = $educationalProjectIntangible;
  371. return $this;
  372. }
  373. /**
  374. * Remove educationalProjectIntangible
  375. *
  376. * @param \AppBundle\Entity\Billing\EducationalProjectIntangible $educationalProjectIntangible
  377. */
  378. public function removeEducationalProjectIntangible(\AppBundle\Entity\Billing\EducationalProjectIntangible $educationalProjectIntangible)
  379. {
  380. $this->educationalProjectIntangible->removeElement($educationalProjectIntangible);
  381. }
  382. /**
  383. * Get educationalProjectIntangible
  384. *
  385. * @return \Doctrine\Common\Collections\Collection
  386. */
  387. public function getEducationalProjectIntangible()
  388. {
  389. return $this->educationalProjectIntangible;
  390. }
  391. /**
  392. * Add educationCurriculum
  393. *
  394. * @param \AppBundle\Entity\Education\EducationCurriculum $educationCurriculum
  395. *
  396. * @return Intangible
  397. */
  398. public function addEducationCurriculum(\AppBundle\Entity\Education\EducationCurriculum $educationCurriculum)
  399. {
  400. $this->educationCurriculums[] = $educationCurriculum;
  401. return $this;
  402. }
  403. /**
  404. * Remove educationCurriculum
  405. *
  406. * @param \AppBundle\Entity\Education\EducationCurriculum $educationCurriculum
  407. */
  408. public function removeEducationCurriculum(\AppBundle\Entity\Education\EducationCurriculum $educationCurriculum)
  409. {
  410. $this->educationCurriculums->removeElement($educationCurriculum);
  411. }
  412. /**
  413. * Get educationCurriculums
  414. *
  415. * @return \Doctrine\Common\Collections\Collection
  416. */
  417. public function getEducationCurriculums()
  418. {
  419. return $this->educationCurriculums;
  420. }
  421. /**
  422. * Set domain
  423. *
  424. * @param string $domain
  425. *
  426. * @return Intangible
  427. */
  428. public function setDomain($domain)
  429. {
  430. $this->domain = $domain;
  431. return $this;
  432. }
  433. /**
  434. * Get domain
  435. *
  436. * @return string
  437. */
  438. public function getDomain()
  439. {
  440. return $this->domain;
  441. }
  442. /**
  443. * Add accessIntangible
  444. *
  445. * @param \AppBundle\Entity\Billing\AccessIntangible $accessIntangible
  446. *
  447. * @return Intangible
  448. */
  449. public function addAccessIntangible(\AppBundle\Entity\Billing\AccessIntangible $accessIntangible)
  450. {
  451. $this->accessIntangibles[] = $accessIntangible;
  452. return $this;
  453. }
  454. /**
  455. * Remove accessIntangible
  456. *
  457. * @param \AppBundle\Entity\Billing\AccessIntangible $accessIntangible
  458. */
  459. public function removeAccessIntangible(\AppBundle\Entity\Billing\AccessIntangible $accessIntangible)
  460. {
  461. $this->accessIntangibles->removeElement($accessIntangible);
  462. }
  463. /**
  464. * Get accessIntangibles
  465. *
  466. * @return \Doctrine\Common\Collections\Collection
  467. */
  468. public function getAccessIntangibles()
  469. {
  470. return $this->accessIntangibles;
  471. }
  472. }