<?php
namespace App\Entity;
use App\Repository\TeacherRepository;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
/**
* @ORM\Entity(repositoryClass=TeacherRepository::class)
*/
class Teacher
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $firstName;
/**
* @ORM\Column(type="string", length=255)
*/
private $lastName;
/**
* @ORM\Column(type="boolean")
*/
private $gender;
/**
* @ORM\Column(type="date")
*/
private $birthDate;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $phone;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $email;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $speciality;
/**
* @ORM\ManyToOne(targetEntity=School::class, inversedBy="teachers")
* @ORM\JoinColumn(nullable=false)
*/
private $school;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private $updatedAt;
/**
* @ORM\ManyToMany(targetEntity=Promotion::class, mappedBy="teachers")
*/
private $promotions;
/**
* @ORM\ManyToMany(targetEntity=Course::class, inversedBy="teachers")
*/
private $courses;
public function __construct()
{
$this->promotions = new ArrayCollection();
$this->courses = new ArrayCollection();
}
public function __toString(): string
{
return $this->firstName . ' ' . $this->lastName;
}
public function getId(): ?int
{
return $this->id;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function setFirstName(string $firstName): self
{
$this->firstName = $firstName;
return $this;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName(string $lastName): self
{
$this->lastName = $lastName;
return $this;
}
public function getGender(): ?bool
{
return $this->gender;
}
public function setGender(bool $gender): self
{
$this->gender = $gender;
return $this;
}
public function getBirthDate(): ?\DateTimeInterface
{
return $this->birthDate;
}
public function setBirthDate(\DateTimeInterface $birthDate): self
{
$this->birthDate = $birthDate;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getSpeciality(): ?string
{
return $this->speciality;
}
public function setSpeciality(?string $speciality): self
{
$this->speciality = $speciality;
return $this;
}
public function getSchool(): ?School
{
return $this->school;
}
public function setSchool(?School $school): self
{
$this->school = $school;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @return Collection<int, Promotion>
*/
public function getPromotions(): Collection
{
return $this->promotions;
}
public function addPromotion(Promotion $promotion): self
{
if (!$this->promotions->contains($promotion)) {
$this->promotions->add($promotion);
$promotion->addTeacher($this);
}
return $this;
}
public function removePromotion(Promotion $promotion): self
{
if ($this->promotions->removeElement($promotion)) {
$promotion->removeTeacher($this);
}
return $this;
}
/**
* @return Collection<int, Course>
*/
public function getCourses(): Collection
{
return $this->courses;
}
public function addCourse(Course $course): self
{
if (!$this->courses->contains($course)) {
$this->courses->add($course);
$course->addTeacher($this);
}
return $this;
}
public function removeCourse(Course $course): self
{
if ($this->courses->removeElement($course)) {
$course->removeTeacher($this);
}
return $this;
}
}