src/Entity/TeacherRegister/TeacherRegisterDisciplineClass.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\TeacherRegister;
  3. use App\Entity\Discipline;
  4. use App\Repository\TeacherRegister\TeacherRegisterDisciplineClassRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. /**
  8. * @ORM\Entity(repositoryClass=TeacherRegisterDisciplineClassRepository::class)
  9. */
  10. class TeacherRegisterDisciplineClass
  11. {
  12. /**
  13. * @ORM\Id
  14. * @ORM\GeneratedValue
  15. * @ORM\Column(type="integer")
  16. * @Groups({"TeacherRegisterList"})
  17. */
  18. private $id;
  19. /**
  20. * @ORM\ManyToOne(targetEntity=TeacherRegister::class, inversedBy="teacherRegisterDisciplineClasses")
  21. */
  22. private $teacherRegister;
  23. /**
  24. * @ORM\ManyToOne(targetEntity=Discipline::class)
  25. * @Groups({"TeacherRegisterList"})
  26. */
  27. private $discipline;
  28. /**
  29. * @ORM\Column(type="json", nullable=true)
  30. * @Groups({"TeacherRegisterList"})
  31. */
  32. private $classes = [];
  33. /**
  34. * @ORM\Column(type="integer", nullable=true)
  35. * @Groups({"TeacherRegisterList"})
  36. */
  37. private $vbe;
  38. /**
  39. * @ORM\Column(type="json", nullable=true)
  40. * @Groups({"TeacherRegisterList"})
  41. */
  42. private $classYears = [];
  43. public function getId(): ?int
  44. {
  45. return $this->id;
  46. }
  47. public function getTeacherRegister(): ?TeacherRegister
  48. {
  49. return $this->teacherRegister;
  50. }
  51. public function setTeacherRegister(?TeacherRegister $teacherRegister): self
  52. {
  53. $this->teacherRegister = $teacherRegister;
  54. return $this;
  55. }
  56. public function getDiscipline(): ?Discipline
  57. {
  58. return $this->discipline;
  59. }
  60. public function setDiscipline(?Discipline $discipline): self
  61. {
  62. $this->discipline = $discipline;
  63. return $this;
  64. }
  65. public function getClasses(): ?array
  66. {
  67. $classesMap = [
  68. 'Priešmokyklinukai',
  69. '1 – 4 kl.',
  70. '5 – 8 kl.',
  71. '9 – 10 kl.',
  72. '11 – 12 kl.',
  73. 'Suaugę',
  74. ];
  75. if(!is_array($this->classes))
  76. {
  77. $this->classes = [];
  78. }
  79. $classes = [];
  80. foreach($classesMap as $class)
  81. {
  82. if(in_array($class, $this->classes))
  83. {
  84. $classes[] = $class;
  85. }
  86. }
  87. return $classes;
  88. }
  89. public function setClasses(?array $classes): self
  90. {
  91. $this->classes = $classes;
  92. return $this;
  93. }
  94. public function getVbe(): ?int
  95. {
  96. return $this->vbe;
  97. }
  98. public function setVbe(?int $vbe): self
  99. {
  100. $this->vbe = $vbe;
  101. return $this;
  102. }
  103. public function getClassYears(): ?array
  104. {
  105. if(!is_array($this->classYears))
  106. {
  107. $this->classYears = [];
  108. }
  109. sort($this->classYears);
  110. return $this->classYears;
  111. }
  112. public function setClassYears(?array $classYears): self
  113. {
  114. $this->classYears = $classYears;
  115. return $this;
  116. }
  117. }