src/Entity/Subject.php line 12

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\SubjectRepository")
  8. */
  9. class Subject
  10. {
  11. /**
  12. * @ORM\Id()
  13. * @ORM\GeneratedValue()
  14. * @ORM\Column(type="integer")
  15. */
  16. private $id;
  17. /**
  18. * @ORM\Column(type="string", length=100)
  19. */
  20. private $name;
  21. /**
  22. * @ORM\Column(type="string", length=255)
  23. */
  24. private $description;
  25. /**
  26. * @ORM\ManyToOne(targetEntity="App\Entity\Category", inversedBy="subjects")
  27. * @ORM\JoinColumn(nullable=false)
  28. */
  29. private $category;
  30. /**
  31. * @ORM\OneToMany(targetEntity="App\Entity\SubscriptionOrder", mappedBy="subject")
  32. */
  33. private $subscriptionOrders;
  34. /**
  35. * @ORM\Column(type="string", length=255)
  36. */
  37. private $nameEn;
  38. /**
  39. * @ORM\Column(type="string", length=255)
  40. */
  41. private $descriptionEn;
  42. /**
  43. * @ORM\OneToMany(targetEntity="App\Entity\SubjectLevel", mappedBy="subject")
  44. */
  45. private $subjectLevels;
  46. /**
  47. * @ORM\OneToMany(targetEntity="App\Entity\ProgramUrl", mappedBy="subject")
  48. */
  49. private $programUrls;
  50. /**
  51. * @ORM\OneToMany(targetEntity="App\Entity\TeacherSubject", mappedBy="subject")
  52. */
  53. private $teacherSubjects;
  54. /**
  55. * @ORM\Column(type="boolean", nullable=true)
  56. */
  57. private $isFree;
  58. /**
  59. * @ORM\Column(type="boolean", nullable=true)
  60. */
  61. private $hasLevel;
  62. /**
  63. * @ORM\Column(type="integer", nullable=true)
  64. */
  65. private $price;
  66. /**
  67. * @ORM\Column(type="boolean", nullable=true)
  68. */
  69. private $isPublic;
  70. /**
  71. * @ORM\Column(type="string", length=100, nullable=true)
  72. */
  73. private $tagName;
  74. /**
  75. * @ORM\OneToMany(targetEntity=LevelTest::class, mappedBy="subject")
  76. */
  77. private $levelTests;
  78. /**
  79. * @ORM\OneToMany(targetEntity=SessionRegistrationDate::class, mappedBy="subject")
  80. */
  81. private $sessionRegistrationDates;
  82. /**
  83. * @ORM\OneToMany(targetEntity=StripePlanForGroup::class, mappedBy="subject")
  84. */
  85. private $stripePlanForGroups;
  86. /**
  87. * @ORM\OneToMany(targetEntity=UserPlacementTest::class, mappedBy="subject")
  88. */
  89. private $userPlacementTests;
  90. /**
  91. * @ORM\OneToMany(targetEntity=Exam::class, mappedBy="program", orphanRemoval=true)
  92. */
  93. private $exams;
  94. /**
  95. * @ORM\OneToMany(targetEntity=TrainingReport::class, mappedBy="program")
  96. */
  97. private $trainingReports;
  98. /**
  99. * @ORM\OneToMany(targetEntity=Discount::class, mappedBy="subject")
  100. */
  101. private $discounts;
  102. /**
  103. * @ORM\Column(type="boolean", nullable=true)
  104. */
  105. private $isDefault;
  106. /**
  107. * @ORM\Column(type="boolean", nullable=true)
  108. */
  109. private $hasMidExam;
  110. /**
  111. * @ORM\Column(type="boolean", nullable=true)
  112. */
  113. private $hasEndExam;
  114. /**
  115. * @ORM\Column(type="boolean", nullable=true)
  116. */
  117. private $hasOralExam;
  118. /**
  119. * @ORM\OneToMany(targetEntity=TeacherLeveltest::class, mappedBy="subject")
  120. */
  121. private $teacherLeveltests;
  122. /**
  123. * @ORM\OneToMany(targetEntity=LevelTestAdvice::class, mappedBy="subject")
  124. */
  125. private $levelTestAdvice;
  126. public function __construct()
  127. {
  128. $this->teachers = new ArrayCollection();
  129. $this->subscriptionOrders = new ArrayCollection();
  130. $this->subjectLevels = new ArrayCollection();
  131. $this->programUrls = new ArrayCollection();
  132. $this->teacherSubjects = new ArrayCollection();
  133. $this->levelTests = new ArrayCollection();
  134. $this->sessionRegistrationDates = new ArrayCollection();
  135. $this->stripePlanForGroups = new ArrayCollection();
  136. $this->userPlacementTests = new ArrayCollection();
  137. $this->exams = new ArrayCollection();
  138. $this->trainingReports = new ArrayCollection();
  139. $this->discounts = new ArrayCollection();
  140. $this->teacherLeveltests = new ArrayCollection();
  141. $this->levelTestAdvice = new ArrayCollection();
  142. }
  143. public function getId(): ?int
  144. {
  145. return $this->id;
  146. }
  147. public function getName(): ?string
  148. {
  149. return $this->name;
  150. }
  151. public function setName(string $name): self
  152. {
  153. $this->name = $name;
  154. return $this;
  155. }
  156. public function getDescription(): ?string
  157. {
  158. return $this->description;
  159. }
  160. public function setDescription(string $description): self
  161. {
  162. $this->description = $description;
  163. return $this;
  164. }
  165. public function getCategory(): ?Category
  166. {
  167. return $this->category;
  168. }
  169. public function setCategory(?Category $category): self
  170. {
  171. $this->category = $category;
  172. return $this;
  173. }
  174. public function __toString()
  175. {
  176. return $this->getName();
  177. }
  178. /**
  179. * @return Collection|SubscriptionOrder[]
  180. */
  181. public function getSubscriptionOrders(): Collection
  182. {
  183. return $this->subscriptionOrders;
  184. }
  185. public function addSubscriptionOrder(SubscriptionOrder $subscriptionOrder): self
  186. {
  187. if (!$this->subscriptionOrders->contains($subscriptionOrder)) {
  188. $this->subscriptionOrders[] = $subscriptionOrder;
  189. $subscriptionOrder->setSubject($this);
  190. }
  191. return $this;
  192. }
  193. public function removeSubscriptionOrder(SubscriptionOrder $subscriptionOrder): self
  194. {
  195. if ($this->subscriptionOrders->contains($subscriptionOrder)) {
  196. $this->subscriptionOrders->removeElement($subscriptionOrder);
  197. // set the owning side to null (unless already changed)
  198. if ($subscriptionOrder->getSubject() === $this) {
  199. $subscriptionOrder->setSubject(null);
  200. }
  201. }
  202. return $this;
  203. }
  204. public function getNameEn(): ?string
  205. {
  206. return $this->nameEn;
  207. }
  208. public function setNameEn(?string $nameEn): self
  209. {
  210. $this->nameEn = $nameEn;
  211. return $this;
  212. }
  213. public function getDescriptionEn(): ?string
  214. {
  215. return $this->descriptionEn;
  216. }
  217. public function setDescriptionEn(?string $descriptionEn): self
  218. {
  219. $this->descriptionEn = $descriptionEn;
  220. return $this;
  221. }
  222. /**
  223. * @return Collection|SubjectLevel[]
  224. */
  225. public function getSubjectLevels(): Collection
  226. {
  227. return $this->subjectLevels;
  228. }
  229. public function addSubjectLevel(SubjectLevel $subjectLevel): self
  230. {
  231. if (!$this->subjectLevels->contains($subjectLevel)) {
  232. $this->subjectLevels[] = $subjectLevel;
  233. $subjectLevel->setSubject($this);
  234. }
  235. return $this;
  236. }
  237. public function removeSubjectLevel(SubjectLevel $subjectLevel): self
  238. {
  239. if ($this->subjectLevels->contains($subjectLevel)) {
  240. $this->subjectLevels->removeElement($subjectLevel);
  241. // set the owning side to null (unless already changed)
  242. if ($subjectLevel->getSubject() === $this) {
  243. $subjectLevel->setSubject(null);
  244. }
  245. }
  246. return $this;
  247. }
  248. /**
  249. * @return Collection|ProgramUrl[]
  250. */
  251. public function getProgramUrls(): Collection
  252. {
  253. return $this->programUrls;
  254. }
  255. public function addProgramUrl(ProgramUrl $programUrl): self
  256. {
  257. if (!$this->programUrls->contains($programUrl)) {
  258. $this->programUrls[] = $programUrl;
  259. $programUrl->setSubject($this);
  260. }
  261. return $this;
  262. }
  263. public function removeProgramUrl(ProgramUrl $programUrl): self
  264. {
  265. if ($this->programUrls->contains($programUrl)) {
  266. $this->programUrls->removeElement($programUrl);
  267. // set the owning side to null (unless already changed)
  268. if ($programUrl->getSubject() === $this) {
  269. $programUrl->setSubject(null);
  270. }
  271. }
  272. return $this;
  273. }
  274. /**
  275. * @return Collection|TeacherSubject[]
  276. */
  277. public function getTeacherSubjects(): Collection
  278. {
  279. return $this->teacherSubjects;
  280. }
  281. public function addTeacherSubject(TeacherSubject $teacherSubject): self
  282. {
  283. if (!$this->teacherSubjects->contains($teacherSubject)) {
  284. $this->teacherSubjects[] = $teacherSubject;
  285. $teacherSubject->setSubject($this);
  286. }
  287. return $this;
  288. }
  289. public function removeTeacherSubject(TeacherSubject $teacherSubject): self
  290. {
  291. if ($this->teacherSubjects->contains($teacherSubject)) {
  292. $this->teacherSubjects->removeElement($teacherSubject);
  293. // set the owning side to null (unless already changed)
  294. if ($teacherSubject->getSubject() === $this) {
  295. $teacherSubject->setSubject(null);
  296. }
  297. }
  298. return $this;
  299. }
  300. public function getIsFree(): ?bool
  301. {
  302. return $this->isFree;
  303. }
  304. public function setIsFree(?bool $isFree): self
  305. {
  306. $this->isFree = $isFree;
  307. return $this;
  308. }
  309. public function getHasLevel(): ?bool
  310. {
  311. return $this->hasLevel;
  312. }
  313. public function setHasLevel(?bool $hasLevel): self
  314. {
  315. $this->hasLevel = $hasLevel;
  316. return $this;
  317. }
  318. public function getPrice(): ?int
  319. {
  320. return $this->price;
  321. }
  322. public function setPrice(?int $price): self
  323. {
  324. $this->price = $price;
  325. return $this;
  326. }
  327. public function getIsPublic(): ?bool
  328. {
  329. return $this->isPublic;
  330. }
  331. public function setIsPublic(?bool $isPublic): self
  332. {
  333. $this->isPublic = $isPublic;
  334. return $this;
  335. }
  336. public function getTagName(): ?string
  337. {
  338. return $this->tagName;
  339. }
  340. public function setTagName(?string $tagName): self
  341. {
  342. $this->tagName = $tagName;
  343. return $this;
  344. }
  345. /**
  346. * @return Collection|LevelTest[]
  347. */
  348. public function getLevelTests(): Collection
  349. {
  350. return $this->levelTests;
  351. }
  352. public function addLevelTest(LevelTest $levelTest): self
  353. {
  354. if (!$this->levelTests->contains($levelTest)) {
  355. $this->levelTests[] = $levelTest;
  356. $levelTest->setSubject($this);
  357. }
  358. return $this;
  359. }
  360. public function removeLevelTest(LevelTest $levelTest): self
  361. {
  362. if ($this->levelTests->removeElement($levelTest)) {
  363. // set the owning side to null (unless already changed)
  364. if ($levelTest->getSubject() === $this) {
  365. $levelTest->setSubject(null);
  366. }
  367. }
  368. return $this;
  369. }
  370. /**
  371. * @return Collection|SessionRegistrationDate[]
  372. */
  373. public function getSessionRegistrationDates(): Collection
  374. {
  375. return $this->sessionRegistrationDates;
  376. }
  377. public function addSessionRegistrationDate(SessionRegistrationDate $sessionRegistrationDate): self
  378. {
  379. if (!$this->sessionRegistrationDates->contains($sessionRegistrationDate)) {
  380. $this->sessionRegistrationDates[] = $sessionRegistrationDate;
  381. $sessionRegistrationDate->setSubject($this);
  382. }
  383. return $this;
  384. }
  385. public function removeSessionRegistrationDate(SessionRegistrationDate $sessionRegistrationDate): self
  386. {
  387. if ($this->sessionRegistrationDates->removeElement($sessionRegistrationDate)) {
  388. // set the owning side to null (unless already changed)
  389. if ($sessionRegistrationDate->getSubject() === $this) {
  390. $sessionRegistrationDate->setSubject(null);
  391. }
  392. }
  393. return $this;
  394. }
  395. /**
  396. * @return Collection|StripePlanForGroup[]
  397. */
  398. public function getStripePlanForGroups(): Collection
  399. {
  400. return $this->stripePlanForGroups;
  401. }
  402. public function addStripePlanForGroup(StripePlanForGroup $stripePlanForGroup): self
  403. {
  404. if (!$this->stripePlanForGroups->contains($stripePlanForGroup)) {
  405. $this->stripePlanForGroups[] = $stripePlanForGroup;
  406. $stripePlanForGroup->setSubject($this);
  407. }
  408. return $this;
  409. }
  410. public function removeStripePlanForGroup(StripePlanForGroup $stripePlanForGroup): self
  411. {
  412. if ($this->stripePlanForGroups->removeElement($stripePlanForGroup)) {
  413. // set the owning side to null (unless already changed)
  414. if ($stripePlanForGroup->getSubject() === $this) {
  415. $stripePlanForGroup->setSubject(null);
  416. }
  417. }
  418. return $this;
  419. }
  420. /**
  421. * @return Collection|UserPlacementTest[]
  422. */
  423. public function getUserPlacementTests(): Collection
  424. {
  425. return $this->userPlacementTests;
  426. }
  427. public function addUserPlacementTest(UserPlacementTest $userPlacementTest): self
  428. {
  429. if (!$this->userPlacementTests->contains($userPlacementTest)) {
  430. $this->userPlacementTests[] = $userPlacementTest;
  431. $userPlacementTest->setSubject($this);
  432. }
  433. return $this;
  434. }
  435. public function removeUserPlacementTest(UserPlacementTest $userPlacementTest): self
  436. {
  437. if ($this->userPlacementTests->removeElement($userPlacementTest)) {
  438. // set the owning side to null (unless already changed)
  439. if ($userPlacementTest->getSubject() === $this) {
  440. $userPlacementTest->setSubject(null);
  441. }
  442. }
  443. return $this;
  444. }
  445. /**
  446. * @return Collection|Exam[]
  447. */
  448. public function getExams(): Collection
  449. {
  450. return $this->exams;
  451. }
  452. public function addExam(Exam $exam): self
  453. {
  454. if (!$this->exams->contains($exam)) {
  455. $this->exams[] = $exam;
  456. $exam->setProgram($this);
  457. }
  458. return $this;
  459. }
  460. public function removeExam(Exam $exam): self
  461. {
  462. if ($this->exams->removeElement($exam)) {
  463. // set the owning side to null (unless already changed)
  464. if ($exam->getProgram() === $this) {
  465. $exam->setProgram(null);
  466. }
  467. }
  468. return $this;
  469. }
  470. /**
  471. * @return Collection|TrainingReport[]
  472. */
  473. public function getTrainingReports(): Collection
  474. {
  475. return $this->trainingReports;
  476. }
  477. public function addTrainingReport(TrainingReport $trainingReport): self
  478. {
  479. if (!$this->trainingReports->contains($trainingReport)) {
  480. $this->trainingReports[] = $trainingReport;
  481. $trainingReport->setProgram($this);
  482. }
  483. return $this;
  484. }
  485. public function removeTrainingReport(TrainingReport $trainingReport): self
  486. {
  487. if ($this->trainingReports->removeElement($trainingReport)) {
  488. // set the owning side to null (unless already changed)
  489. if ($trainingReport->getProgram() === $this) {
  490. $trainingReport->setProgram(null);
  491. }
  492. }
  493. return $this;
  494. }
  495. /**
  496. * @return Collection|Discount[]
  497. */
  498. public function getDiscounts(): Collection
  499. {
  500. return $this->discounts;
  501. }
  502. public function addDiscount(Discount $discount): self
  503. {
  504. if (!$this->discounts->contains($discount)) {
  505. $this->discounts[] = $discount;
  506. $discount->setSubject($this);
  507. }
  508. return $this;
  509. }
  510. public function removeDiscount(Discount $discount): self
  511. {
  512. if ($this->discounts->removeElement($discount)) {
  513. // set the owning side to null (unless already changed)
  514. if ($discount->getSubject() === $this) {
  515. $discount->setSubject(null);
  516. }
  517. }
  518. return $this;
  519. }
  520. public function getIsDefault(): ?bool
  521. {
  522. return $this->isDefault;
  523. }
  524. public function setIsDefault(?bool $isDefault): self
  525. {
  526. $this->isDefault = $isDefault;
  527. return $this;
  528. }
  529. public function getHasMidExam(): ?bool
  530. {
  531. return $this->hasMidExam;
  532. }
  533. public function setHasMidExam(?bool $hasMidExam): self
  534. {
  535. $this->hasMidExam = $hasMidExam;
  536. return $this;
  537. }
  538. public function getHasEndExam(): ?bool
  539. {
  540. return $this->hasEndExam;
  541. }
  542. public function setHasEndExam(?bool $hasEndExam): self
  543. {
  544. $this->hasEndExam = $hasEndExam;
  545. return $this;
  546. }
  547. public function getHasOralExam(): ?bool
  548. {
  549. return $this->hasOralExam;
  550. }
  551. public function setHasOralExam(?bool $hasOralExam): self
  552. {
  553. $this->hasOralExam = $hasOralExam;
  554. return $this;
  555. }
  556. /**
  557. * @return Collection<int, TeacherLeveltest>
  558. */
  559. public function getTeacherLeveltests(): Collection
  560. {
  561. return $this->teacherLeveltests;
  562. }
  563. public function addTeacherLeveltest(TeacherLeveltest $teacherLeveltest): self
  564. {
  565. if (!$this->teacherLeveltests->contains($teacherLeveltest)) {
  566. $this->teacherLeveltests[] = $teacherLeveltest;
  567. $teacherLeveltest->setSubject($this);
  568. }
  569. return $this;
  570. }
  571. public function removeTeacherLeveltest(TeacherLeveltest $teacherLeveltest): self
  572. {
  573. if ($this->teacherLeveltests->removeElement($teacherLeveltest)) {
  574. // set the owning side to null (unless already changed)
  575. if ($teacherLeveltest->getSubject() === $this) {
  576. $teacherLeveltest->setSubject(null);
  577. }
  578. }
  579. return $this;
  580. }
  581. /**
  582. * @return Collection<int, LevelTestAdvice>
  583. */
  584. public function getLevelTestAdvice(): Collection
  585. {
  586. return $this->levelTestAdvice;
  587. }
  588. public function addLevelTestAdvice(LevelTestAdvice $levelTestAdvice): self
  589. {
  590. if (!$this->levelTestAdvice->contains($levelTestAdvice)) {
  591. $this->levelTestAdvice[] = $levelTestAdvice;
  592. $levelTestAdvice->setSubject($this);
  593. }
  594. return $this;
  595. }
  596. public function removeLevelTestAdvice(LevelTestAdvice $levelTestAdvice): self
  597. {
  598. if ($this->levelTestAdvice->removeElement($levelTestAdvice)) {
  599. // set the owning side to null (unless already changed)
  600. if ($levelTestAdvice->getSubject() === $this) {
  601. $levelTestAdvice->setSubject(null);
  602. }
  603. }
  604. return $this;
  605. }
  606. }