src/Entity/SessionOrder.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7. * @ORM\Entity(repositoryClass="App\Repository\GroupRepository")
  8. * @ORM\HasLifecycleCallbacks()
  9. */
  10. class SessionOrder
  11. {
  12. /**
  13. * @ORM\Id()
  14. * @ORM\GeneratedValue()
  15. * @ORM\Column(type="integer")
  16. */
  17. private $id;
  18. /**
  19. * @ORM\Column(type="datetime")
  20. */
  21. private $purchaseDate;
  22. /**
  23. * @ORM\ManyToOne(targetEntity="App\Entity\Session", inversedBy="sessionOrder")
  24. * @ORM\JoinColumn(nullable=false)
  25. */
  26. private $session;
  27. /**
  28. * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="sessionOrder")
  29. */
  30. private $students;
  31. /**
  32. * @ORM\Column(type="string", length=255)
  33. */
  34. private $stripeCustomerId;
  35. /**
  36. * @ORM\OneToMany(targetEntity="App\Entity\AbsenceLog", mappedBy="groupSession")
  37. */
  38. private $absenceLogs;
  39. /**
  40. * @ORM\ManyToOne(targetEntity="App\Entity\Child", inversedBy="sessionOrders")
  41. */
  42. private $participant;
  43. /**
  44. * @ORM\Column(type="decimal", precision=25, scale=15)
  45. */
  46. private $amountPaid;
  47. /**
  48. * @ORM\OneToMany(targetEntity="App\Entity\GroupCourseLessonReport", mappedBy="sessionOrder")
  49. */
  50. private $groupCourseLessonReports;
  51. /**
  52. * @ORM\Column(type="boolean", nullable=true)
  53. */
  54. private $canceledByUs;
  55. /**
  56. * @ORM\Column(type="boolean", nullable=true)
  57. */
  58. private $canceledByStudent;
  59. /**
  60. * @ORM\Column(type="boolean", nullable=true)
  61. */
  62. private $isActif;
  63. /**
  64. * @ORM\Column(type="datetime", nullable=true)
  65. */
  66. private $canceledAt;
  67. /**
  68. * @ORM\OneToMany(targetEntity="App\Entity\Homework", mappedBy="RelatedToGroupCourses")
  69. */
  70. private $homeworks;
  71. /**
  72. * @ORM\Column(type="boolean")
  73. */
  74. private $isTwoTime;
  75. /**
  76. * @ORM\Column(type="integer", nullable=true)
  77. */
  78. private $paymentNb;
  79. /**
  80. * @ORM\Column(type="string", length=50, nullable=true)
  81. */
  82. private $cardBrand;
  83. /**
  84. * @ORM\Column(type="string", length=50, nullable=true)
  85. */
  86. private $cardLast4;
  87. /**
  88. * @ORM\Column(type="string", length=255, nullable=true)
  89. */
  90. private $nextPaymentTimeStamp;
  91. /**
  92. * @ORM\Column(type="string", length=255, nullable=true)
  93. */
  94. private $stripeSubscriptionId;
  95. /**
  96. * @ORM\OneToMany(targetEntity="App\Entity\EmailListSubscribeLostLog", mappedBy="sessionOrder")
  97. */
  98. private $subscribeLostLogs;
  99. /**
  100. * @ORM\OneToMany(targetEntity="App\Entity\EmailListUnsubscribeLog", mappedBy="sessionOrder")
  101. */
  102. private $unsubscribeLogs;
  103. /**
  104. * @ORM\OneToMany(targetEntity=UserPlacementTest::class, mappedBy="sessionOrder")
  105. */
  106. private $userPlacementTests;
  107. /**
  108. * @ORM\OneToMany(targetEntity=Exam::class, mappedBy="relatedToGroupCourses")
  109. */
  110. private $exams;
  111. /**
  112. * @ORM\OneToMany(targetEntity=TrainingReport::class, mappedBy="relatedToGroupCourse")
  113. */
  114. private $trainingReports;
  115. /**
  116. * @ORM\Column(type="string", length=3, nullable=true)
  117. */
  118. private $paymentCurrency;
  119. /**
  120. * @ORM\Column(type="decimal", precision=25, scale=15, nullable=true)
  121. */
  122. private $amountPaidLocalCurrency;
  123. /**
  124. * @ORM\Column(type="decimal", precision=25, scale=15, nullable=true)
  125. */
  126. private $amountReceivedUsd;
  127. /**
  128. * @ORM\Column(type="decimal", precision=25, scale=15, nullable=true)
  129. */
  130. private $stripeFees;
  131. public function __construct()
  132. {
  133. $this->absenceLogs = new ArrayCollection();
  134. $this->groupCourseLessonReports = new ArrayCollection();
  135. $this->homeworks = new ArrayCollection();
  136. $this->subscribeLostLogs = new ArrayCollection();
  137. $this->unsubscribeLogs = new ArrayCollection();
  138. $this->userPlacementTests = new ArrayCollection();
  139. $this->exams = new ArrayCollection();
  140. $this->trainingReports = new ArrayCollection();
  141. }
  142. public function getId(): ?int
  143. {
  144. return $this->id;
  145. }
  146. public function getPurchaseDate(): ?\DateTimeInterface
  147. {
  148. return $this->purchaseDate;
  149. }
  150. public function setPurchaseDate(\DateTimeInterface $purchaseDate): self
  151. {
  152. $this->purchaseDate = $purchaseDate;
  153. return $this;
  154. }
  155. /**
  156. * @ORM\PrePersist()
  157. *
  158. * @return void
  159. */
  160. public function setPurchaseDateOnPersist()
  161. {
  162. $this->purchaseDate = new \DateTime();
  163. }
  164. public function getSession(): ?Session
  165. {
  166. return $this->session;
  167. }
  168. public function setSession(?Session $session): self
  169. {
  170. $this->session = $session;
  171. return $this;
  172. }
  173. public function getStudents(): ?User
  174. {
  175. return $this->students;
  176. }
  177. public function setStudents(?User $students): self
  178. {
  179. $this->students = $students;
  180. return $this;
  181. }
  182. public function getStripeCustomerId(): ?string
  183. {
  184. return $this->stripeCustomerId;
  185. }
  186. public function setStripeCustomerId(string $stripeCustomerId): self
  187. {
  188. $this->stripeCustomerId = $stripeCustomerId;
  189. return $this;
  190. }
  191. /**
  192. * @return Collection|AbsenceLog[]
  193. */
  194. public function getAbsenceLogs(): Collection
  195. {
  196. return $this->absenceLogs;
  197. }
  198. public function addAbsenceLog(AbsenceLog $absenceLog): self
  199. {
  200. if (!$this->absenceLogs->contains($absenceLog)) {
  201. $this->absenceLogs[] = $absenceLog;
  202. $absenceLog->setGroupSession($this);
  203. }
  204. return $this;
  205. }
  206. public function removeAbsenceLog(AbsenceLog $absenceLog): self
  207. {
  208. if ($this->absenceLogs->contains($absenceLog)) {
  209. $this->absenceLogs->removeElement($absenceLog);
  210. // set the owning side to null (unless already changed)
  211. if ($absenceLog->getGroupSession() === $this) {
  212. $absenceLog->setGroupSession(null);
  213. }
  214. }
  215. return $this;
  216. }
  217. public function getParticipant(): ?Child
  218. {
  219. return $this->participant;
  220. }
  221. public function setParticipant(?Child $participant): self
  222. {
  223. $this->participant = $participant;
  224. return $this;
  225. }
  226. public function getAmountPaid(): ?float
  227. {
  228. return $this->amountPaid;
  229. }
  230. public function setAmountPaid(float $amountPaid): self
  231. {
  232. $this->amountPaid = round($amountPaid, 2);
  233. return $this;
  234. }
  235. /**
  236. * @return Collection|GroupCourseLessonReport[]
  237. */
  238. public function getGroupCourseLessonReports(): Collection
  239. {
  240. return $this->groupCourseLessonReports;
  241. }
  242. public function addGroupCourseLessonReport(GroupCourseLessonReport $groupCourseLessonReport): self
  243. {
  244. if (!$this->groupCourseLessonReports->contains($groupCourseLessonReport)) {
  245. $this->groupCourseLessonReports[] = $groupCourseLessonReport;
  246. $groupCourseLessonReport->setSessionOrder($this);
  247. }
  248. return $this;
  249. }
  250. public function removeGroupCourseLessonReport(GroupCourseLessonReport $groupCourseLessonReport): self
  251. {
  252. if ($this->groupCourseLessonReports->contains($groupCourseLessonReport)) {
  253. $this->groupCourseLessonReports->removeElement($groupCourseLessonReport);
  254. // set the owning side to null (unless already changed)
  255. if ($groupCourseLessonReport->getSessionOrder() === $this) {
  256. $groupCourseLessonReport->setSessionOrder(null);
  257. }
  258. }
  259. return $this;
  260. }
  261. public function getCanceledByUs(): ?bool
  262. {
  263. return $this->canceledByUs;
  264. }
  265. public function setCanceledByUs(?bool $canceledByUs): self
  266. {
  267. $this->canceledByUs = $canceledByUs;
  268. return $this;
  269. }
  270. public function getCanceledByStudent(): ?bool
  271. {
  272. return $this->canceledByStudent;
  273. }
  274. public function setCanceledByStudent(?bool $canceledByStudent): self
  275. {
  276. $this->canceledByStudent = $canceledByStudent;
  277. return $this;
  278. }
  279. public function getIsActif(): ?bool
  280. {
  281. return $this->isActif;
  282. }
  283. public function setIsActif(?bool $isActif): self
  284. {
  285. $this->isActif = $isActif;
  286. return $this;
  287. }
  288. public function getCanceledAt(): ?\DateTimeInterface
  289. {
  290. return $this->canceledAt;
  291. }
  292. public function setCanceledAt(?\DateTimeInterface $canceledAt): self
  293. {
  294. $this->canceledAt = $canceledAt;
  295. return $this;
  296. }
  297. public function __toString()
  298. {
  299. return $this->getStudents()->getFullname();
  300. }
  301. /**
  302. * @return Collection|Homework[]
  303. */
  304. public function getHomeworks(): Collection
  305. {
  306. return $this->homeworks;
  307. }
  308. public function addHomework(Homework $homework): self
  309. {
  310. if (!$this->homeworks->contains($homework)) {
  311. $this->homeworks[] = $homework;
  312. $homework->setRelatedToGroupCourses($this);
  313. }
  314. return $this;
  315. }
  316. public function removeHomework(Homework $homework): self
  317. {
  318. if ($this->homeworks->contains($homework)) {
  319. $this->homeworks->removeElement($homework);
  320. // set the owning side to null (unless already changed)
  321. if ($homework->getRelatedToGroupCourses() === $this) {
  322. $homework->setRelatedToGroupCourses(null);
  323. }
  324. }
  325. return $this;
  326. }
  327. public function getIsTwoTime(): ?bool
  328. {
  329. return $this->isTwoTime;
  330. }
  331. public function setIsTwoTime(bool $isTwoTime): self
  332. {
  333. $this->isTwoTime = $isTwoTime;
  334. return $this;
  335. }
  336. public function getPaymentNb(): ?int
  337. {
  338. return $this->paymentNb;
  339. }
  340. public function setPaymentNb(?int $paymentNb): self
  341. {
  342. $this->paymentNb = $paymentNb;
  343. return $this;
  344. }
  345. public function getCardBrand(): ?string
  346. {
  347. return $this->cardBrand;
  348. }
  349. public function setCardBrand(?string $cardBrand): self
  350. {
  351. $this->cardBrand = $cardBrand;
  352. return $this;
  353. }
  354. public function getCardLast4(): ?string
  355. {
  356. return $this->cardLast4;
  357. }
  358. public function setCardLast4(?string $cardLast4): self
  359. {
  360. $this->cardLast4 = $cardLast4;
  361. return $this;
  362. }
  363. public function getNextPaymentTimeStamp(): ?string
  364. {
  365. return $this->nextPaymentTimeStamp;
  366. }
  367. public function setNextPaymentTimeStamp(?string $nextPaymentTimeStamp): self
  368. {
  369. $this->nextPaymentTimeStamp = $nextPaymentTimeStamp;
  370. return $this;
  371. }
  372. public function getStripeSubscriptionId(): ?string
  373. {
  374. return $this->stripeSubscriptionId;
  375. }
  376. public function setStripeSubscriptionId(?string $stripeSubscriptionId): self
  377. {
  378. $this->stripeSubscriptionId = $stripeSubscriptionId;
  379. return $this;
  380. }
  381. /**
  382. * @return Collection|EmailListSubscribeLostLog[]
  383. */
  384. public function getSubscribeLostLogs(): Collection
  385. {
  386. return $this->subscribeLostLogs;
  387. }
  388. public function addSubscribeLostLog(EmailListSubscribeLostLog $subscribeLostLog): self
  389. {
  390. if (!$this->subscribeLostLogs->contains($subscribeLostLog)) {
  391. $this->subscribeLostLogs[] = $subscribeLostLog;
  392. $subscribeLostLog->setSessionOrder($this);
  393. }
  394. return $this;
  395. }
  396. public function removeSubscribeLostLog(EmailListSubscribeLostLog $subscribeLostLog): self
  397. {
  398. if ($this->subscribeLostLogs->removeElement($subscribeLostLog)) {
  399. if ($subscribeLostLog->getSessionOrder() === $this) {
  400. $subscribeLostLog->setSessionOrder(null);
  401. }
  402. }
  403. return $this;
  404. }
  405. /**
  406. * @return Collection|EmailListUnsubscribeLog[]
  407. */
  408. public function getUnsubscribeLogs(): Collection
  409. {
  410. return $this->unsubscribeLogs;
  411. }
  412. public function addUnsubscribeLog(EmailListUnsubscribeLog $unsubscribeLog): self
  413. {
  414. if (!$this->unsubscribeLogs->contains($unsubscribeLog)) {
  415. $this->unsubscribeLogs[] = $unsubscribeLog;
  416. $unsubscribeLog->setSessionOrder($this);
  417. }
  418. return $this;
  419. }
  420. public function removeUnsubscribeLog(EmailListUnsubscribeLog $unsubscribeLog): self
  421. {
  422. if ($this->unsubscribeLogs->removeElement($unsubscribeLog)) {
  423. if ($unsubscribeLog->getSessionOrder() === $this) {
  424. $unsubscribeLog->setSessionOrder(null);
  425. }
  426. }
  427. return $this;
  428. }
  429. /**
  430. * @return Collection|UserPlacementTest[]
  431. */
  432. public function getUserPlacementTests(): Collection
  433. {
  434. return $this->userPlacementTests;
  435. }
  436. public function addUserPlacementTest(UserPlacementTest $userPlacementTest): self
  437. {
  438. if (!$this->userPlacementTests->contains($userPlacementTest)) {
  439. $this->userPlacementTests[] = $userPlacementTest;
  440. $userPlacementTest->setSessionOrder($this);
  441. }
  442. return $this;
  443. }
  444. public function removeUserPlacementTest(UserPlacementTest $userPlacementTest): self
  445. {
  446. if ($this->userPlacementTests->removeElement($userPlacementTest)) {
  447. // set the owning side to null (unless already changed)
  448. if ($userPlacementTest->getSessionOrder() === $this) {
  449. $userPlacementTest->setSessionOrder(null);
  450. }
  451. }
  452. return $this;
  453. }
  454. /**
  455. * @return Collection|Exam[]
  456. */
  457. public function getExams(): Collection
  458. {
  459. return $this->exams;
  460. }
  461. public function addExam(Exam $exam): self
  462. {
  463. if (!$this->exams->contains($exam)) {
  464. $this->exams[] = $exam;
  465. $exam->setRelatedToGroupCourses($this);
  466. }
  467. return $this;
  468. }
  469. public function removeExam(Exam $exam): self
  470. {
  471. if ($this->exams->removeElement($exam)) {
  472. // set the owning side to null (unless already changed)
  473. if ($exam->getRelatedToGroupCourses() === $this) {
  474. $exam->setRelatedToGroupCourses(null);
  475. }
  476. }
  477. return $this;
  478. }
  479. /**
  480. * @return Collection|TrainingReport[]
  481. */
  482. public function getTrainingReports(): Collection
  483. {
  484. return $this->trainingReports;
  485. }
  486. public function addTrainingReport(TrainingReport $trainingReport): self
  487. {
  488. if (!$this->trainingReports->contains($trainingReport)) {
  489. $this->trainingReports[] = $trainingReport;
  490. $trainingReport->setRelatedToGroupCourse($this);
  491. }
  492. return $this;
  493. }
  494. public function removeTrainingReport(TrainingReport $trainingReport): self
  495. {
  496. if ($this->trainingReports->removeElement($trainingReport)) {
  497. // set the owning side to null (unless already changed)
  498. if ($trainingReport->getRelatedToGroupCourse() === $this) {
  499. $trainingReport->setRelatedToGroupCourse(null);
  500. }
  501. }
  502. return $this;
  503. }
  504. public function getPaymentCurrency(): ?string
  505. {
  506. return $this->paymentCurrency;
  507. }
  508. public function setPaymentCurrency(?string $paymentCurrency): self
  509. {
  510. $this->paymentCurrency = $paymentCurrency;
  511. return $this;
  512. }
  513. public function getAmountPaidLocalCurrency(): ?float
  514. {
  515. return $this->amountPaidLocalCurrency;
  516. }
  517. public function setAmountPaidLocalCurrency(?float $amountPaidLocalCurrency): self
  518. {
  519. $this->amountPaidLocalCurrency = $amountPaidLocalCurrency ? round($amountPaidLocalCurrency, 2) : null;
  520. return $this;
  521. }
  522. public function getAmountReceivedUsd(): ?float
  523. {
  524. return $this->amountReceivedUsd;
  525. }
  526. public function setAmountReceivedUsd(?float $amountReceivedUsd): self
  527. {
  528. $this->amountReceivedUsd = $amountReceivedUsd ? round($amountReceivedUsd, 2) : null;
  529. return $this;
  530. }
  531. public function getStripeFees(): ?float
  532. {
  533. return $this->stripeFees;
  534. }
  535. public function setStripeFees(?float $stripeFees): self
  536. {
  537. $this->stripeFees = $stripeFees ? round($stripeFees, 2) : null;
  538. return $this;
  539. }
  540. }