src/Entity/Teacher.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TeacherRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. /**
  8.  * @ORM\Entity(repositoryClass=TeacherRepository::class)
  9.  */
  10. class Teacher
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $firstName;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $lastName;
  26.     /**
  27.      * @ORM\Column(type="boolean")
  28.      */
  29.     private $gender;
  30.     /**
  31.      * @ORM\Column(type="date")
  32.      */
  33.     private $birthDate;
  34.     /**
  35.      * @ORM\Column(type="string", length=255, nullable=true)
  36.      */
  37.     private $phone;
  38.     /**
  39.      * @ORM\Column(type="string", length=255, nullable=true)
  40.      */
  41.     private $email;
  42.     /**
  43.      * @ORM\Column(type="string", length=255, nullable=true)
  44.      */
  45.     private $speciality;
  46.     /**
  47.      * @ORM\ManyToOne(targetEntity=School::class, inversedBy="teachers")
  48.      * @ORM\JoinColumn(nullable=false)
  49.      */
  50.     private $school;
  51.     /**
  52.      * @ORM\Column(type="datetime_immutable")
  53.      */
  54.     private $createdAt;
  55.     /**
  56.      * @ORM\Column(type="datetime_immutable", nullable=true)
  57.      */
  58.     private $updatedAt;
  59.     /**
  60.      * @ORM\ManyToMany(targetEntity=Promotion::class, mappedBy="teachers")
  61.      */
  62.     private $promotions;
  63.     /**
  64.      * @ORM\ManyToMany(targetEntity=Course::class, inversedBy="teachers")
  65.      */
  66.     private $courses;
  67.     public function __construct()
  68.     {
  69.         $this->promotions = new ArrayCollection();
  70.         $this->courses = new ArrayCollection();
  71.     }
  72.     public function __toString(): string
  73.     {
  74.         return $this->firstName ' ' $this->lastName;
  75.     }
  76.     public function getId(): ?int
  77.     {
  78.         return $this->id;
  79.     }
  80.     public function getFirstName(): ?string
  81.     {
  82.         return $this->firstName;
  83.     }
  84.     public function setFirstName(string $firstName): self
  85.     {
  86.         $this->firstName $firstName;
  87.         return $this;
  88.     }
  89.     public function getLastName(): ?string
  90.     {
  91.         return $this->lastName;
  92.     }
  93.     public function setLastName(string $lastName): self
  94.     {
  95.         $this->lastName $lastName;
  96.         return $this;
  97.     }
  98.     public function getGender(): ?bool
  99.     {
  100.         return $this->gender;
  101.     }
  102.     public function setGender(bool $gender): self
  103.     {
  104.         $this->gender $gender;
  105.         return $this;
  106.     }
  107.     public function getBirthDate(): ?\DateTimeInterface
  108.     {
  109.         return $this->birthDate;
  110.     }
  111.     public function setBirthDate(\DateTimeInterface $birthDate): self
  112.     {
  113.         $this->birthDate $birthDate;
  114.         return $this;
  115.     }
  116.     public function getPhone(): ?string
  117.     {
  118.         return $this->phone;
  119.     }
  120.     public function setPhone(?string $phone): self
  121.     {
  122.         $this->phone $phone;
  123.         return $this;
  124.     }
  125.     public function getEmail(): ?string
  126.     {
  127.         return $this->email;
  128.     }
  129.     public function setEmail(?string $email): self
  130.     {
  131.         $this->email $email;
  132.         return $this;
  133.     }
  134.     public function getSpeciality(): ?string
  135.     {
  136.         return $this->speciality;
  137.     }
  138.     public function setSpeciality(?string $speciality): self
  139.     {
  140.         $this->speciality $speciality;
  141.         return $this;
  142.     }
  143.     public function getSchool(): ?School
  144.     {
  145.         return $this->school;
  146.     }
  147.     public function setSchool(?School $school): self
  148.     {
  149.         $this->school $school;
  150.         return $this;
  151.     }
  152.     public function getCreatedAt(): ?\DateTimeImmutable
  153.     {
  154.         return $this->createdAt;
  155.     }
  156.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  157.     {
  158.         $this->createdAt $createdAt;
  159.         return $this;
  160.     }
  161.     public function getUpdatedAt(): ?\DateTimeImmutable
  162.     {
  163.         return $this->updatedAt;
  164.     }
  165.     public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
  166.     {
  167.         $this->updatedAt $updatedAt;
  168.         return $this;
  169.     }
  170.     /**
  171.      * @return Collection<int, Promotion>
  172.      */
  173.     public function getPromotions(): Collection
  174.     {
  175.         return $this->promotions;
  176.     }
  177.     public function addPromotion(Promotion $promotion): self
  178.     {
  179.         if (!$this->promotions->contains($promotion)) {
  180.             $this->promotions->add($promotion);
  181.             $promotion->addTeacher($this);
  182.         }
  183.         return $this;
  184.     }
  185.     public function removePromotion(Promotion $promotion): self
  186.     {
  187.         if ($this->promotions->removeElement($promotion)) {
  188.             $promotion->removeTeacher($this);
  189.         }
  190.         return $this;
  191.     }
  192.     /**
  193.      * @return Collection<int, Course>
  194.      */
  195.     public function getCourses(): Collection
  196.     {
  197.         return $this->courses;
  198.     }
  199.     public function addCourse(Course $course): self
  200.     {
  201.         if (!$this->courses->contains($course)) {
  202.             $this->courses->add($course);
  203.             $course->addTeacher($this);
  204.         }
  205.         return $this;
  206.     }
  207.     public function removeCourse(Course $course): self
  208.     {
  209.         if ($this->courses->removeElement($course)) {
  210.             $course->removeTeacher($this);
  211.         }
  212.         return $this;
  213.     }