<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\TeacherRepository")
*/
class Teacher
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="decimal", precision=25, scale=15)
*/
private $hourlySalary;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isGrader = false;
/**
* @ORM\OneToOne(targetEntity="App\Entity\User", inversedBy="teacher", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=false)
*/
private $userId;
/**
* @ORM\OneToMany(targetEntity="App\Entity\TeacherSchedule", mappedBy="teacher")
*/
private $schedules;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Category", inversedBy="teachers")
*/
private $categories;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Session", mappedBy="teacher", orphanRemoval=true)
*/
private $sessionsCourses;
/**
* @ORM\OneToMany(targetEntity="App\Entity\SubscriptionOrder", mappedBy="teacher")
*/
private $subscriptionOrders;
/**
* @ORM\Column(type="boolean")
*/
private $forChildren;
/**
* @ORM\Column(type="decimal", precision=25, scale=15, nullable=true)
*/
private $hourlySalaryWaiting;
/**
* @ORM\OneToMany(targetEntity="App\Entity\TeacherSubject", mappedBy="teacher", cascade={"persist"}, orphanRemoval=true)
* @Assert\Valid()
*/
private $teacherSubjects;
/**
* @ORM\OneToMany(targetEntity="App\Entity\TeacherSalary", mappedBy="teacher")
*/
private $teacherSalaries;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Homework", mappedBy="CorrectedBy")
*/
private $homeworks;
/**
* @ORM\OneToMany(targetEntity="App\Entity\VideoProgram", mappedBy="teacher")
*/
private $videoPrograms;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\VideoProgram", mappedBy="teacherForLesson")
*/
private $videoProgramsCanTeach;
/**
* @ORM\OneToMany(targetEntity="App\Entity\VideoDividend", mappedBy="teacher")
*/
private $videoDividends;
/**
* @ORM\Column(type="string", length=150, nullable=true)
* @Assert\Regex(pattern = "/^#?[a-z\-_0-9]+$/i", htmlPattern = "^#?[a-z\-_0-9]+$/i", message="This must contain only letter or numbers" )
*/
private $slackChannel;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $iban;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $address;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $city;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $zipCode;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $country;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isActif;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isLevelTest;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isCamera;
/**
* @ORM\OneToMany(targetEntity=TrainingReport::class, mappedBy="teacher")
*/
private $trainingReports;
/**
* @ORM\Column(type="decimal", precision=25, scale=15, nullable=true)
*/
private $addonForArabic;
/**
* @ORM\Column(type="decimal", precision=25, scale=15, nullable=true)
*/
private $addonForQuran;
/**
* @ORM\Column(type="decimal", precision=25, scale=15, nullable=true)
*/
private $addonForChildren;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isBeginner;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isIntermediate;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isAdvanced;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $currency;
/**
* @ORM\OneToMany(targetEntity=MainTeacherSalary::class, mappedBy="teacher")
*/
private $mainTeacherSalaries;
/**
* @ORM\OneToMany(targetEntity=TeacherLeveltest::class, mappedBy="teacher")
*/
private $teacherLeveltests;
/**
* @ORM\ManyToOne(targetEntity=Qiraa::class, inversedBy="teachers")
*/
private $Qiraa;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $groupSalary;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $groupWaitingSalary;
public function __construct()
{
$this->schedules = new ArrayCollection();
$this->categories = new ArrayCollection();
$this->sessionsCourses = new ArrayCollection();
$this->subscriptionOrders = new ArrayCollection();
$this->teacherSubjects = new ArrayCollection();
$this->teacherSalaries = new ArrayCollection();
$this->homeworks = new ArrayCollection();
$this->videoPrograms = new ArrayCollection();
$this->videoProgramsCanTeach = new ArrayCollection();
$this->videoDividends = new ArrayCollection();
$this->trainingReports = new ArrayCollection();
$this->mainTeacherSalaries = new ArrayCollection();
$this->teacherLeveltests = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getHourlySalary(): ?float
{
return $this->hourlySalary;
}
public function setHourlySalary(float $hourlySalary): self
{
$this->hourlySalary = round($hourlySalary, 2);
return $this;
}
public function getIsGrader(): ?bool
{
return $this->isGrader;
}
public function setIsGrader(?bool $isGrader): self
{
$this->isGrader = $isGrader;
return $this;
}
public function getUserId(): ?User
{
return $this->userId;
}
public function setUserId(User $userId): self
{
$this->userId = $userId;
return $this;
}
/**
* @return Collection|TeacherSchedule[]
*/
public function getSchedules(): Collection
{
return $this->schedules;
}
public function addSchedule(TeacherSchedule $schedule): self
{
if ( ! $this->schedules->contains($schedule)) {
$this->schedules[] = $schedule;
$schedule->setTeacher($this);
}
return $this;
}
public function removeSchedule(TeacherSchedule $schedule): self
{
if ($this->schedules->contains($schedule)) {
$this->schedules->removeElement($schedule);
// set the owning side to null (unless already changed)
if ($schedule->getTeacher() === $this) {
$schedule->setTeacher(null);
}
}
return $this;
}
/**
* @return Collection|Category[]
*/
public function getCategories(): Collection
{
return $this->categories;
}
public function addCategory(Category $category): self
{
if ( ! $this->categories->contains($category)) {
$this->categories[] = $category;
}
return $this;
}
public function removeCategory(Category $category): self
{
if ($this->categories->contains($category)) {
$this->categories->removeElement($category);
}
return $this;
}
/**
* @return Collection|Session[]
*/
public function getSessionsCourses(): Collection
{
return $this->sessionsCourses;
}
public function addSession(Session $session): self
{
if ( ! $this->sessionsCourses->contains($session)) {
$this->sessionsCourses[] = $session;
$session->setTeacher($this);
}
return $this;
}
public function removeSession(Session $session): self
{
if ($this->sessionsCourses->contains($session)) {
$this->sessionsCourses->removeElement($session);
// set the owning side to null (unless already changed)
if ($session->getTeacher() === $this) {
$session->setTeacher(null);
}
}
return $this;
}
/**
* @return Collection|SubscriptionOrder[]
*/
public function getSubscriptionOrders(): Collection
{
return $this->subscriptionOrders;
}
public function addSubscriptionOrder(SubscriptionOrder $subscriptionOrder): self
{
if ( ! $this->subscriptionOrders->contains($subscriptionOrder)) {
$this->subscriptionOrders[] = $subscriptionOrder;
$subscriptionOrder->setTeacher($this);
}
return $this;
}
public function removeSubscriptionOrder(SubscriptionOrder $subscriptionOrder): self
{
if ($this->subscriptionOrders->contains($subscriptionOrder)) {
$this->subscriptionOrders->removeElement($subscriptionOrder);
// set the owning side to null (unless already changed)
if ($subscriptionOrder->getTeacher() === $this) {
$subscriptionOrder->setTeacher(null);
}
}
return $this;
}
public function getForChildren(): ?bool
{
return $this->forChildren;
}
public function setForChildren(?bool $forChildren): self
{
$this->forChildren = $forChildren;
return $this;
}
public function __toString()
{
return $this->getUserId()->getFullname();
}
public function getHourlySalaryWaiting(): ?float
{
return $this->hourlySalaryWaiting;
}
public function setHourlySalaryWaiting(?float $hourlySalaryWaiting): self
{
$this->hourlySalaryWaiting = round($hourlySalaryWaiting, 2);
return $this;
}
/**
* @return Collection|TeacherSubject[]
*/
public function getTeacherSubjects(): Collection
{
return $this->teacherSubjects;
}
public function addTeacherSubject(TeacherSubject $teacherSubject): self
{
if ( ! $this->teacherSubjects->contains($teacherSubject)) {
$this->teacherSubjects[] = $teacherSubject;
$teacherSubject->setTeacher($this);
}
return $this;
}
public function removeTeacherSubject(TeacherSubject $teacherSubject): self
{
if ($this->teacherSubjects->contains($teacherSubject)) {
$this->teacherSubjects->removeElement($teacherSubject);
// set the owning side to null (unless already changed)
// if ($teacherSubject->getTeacher() === $this) {
// $teacherSubject->setTeacher(null);
// }
}
return $this;
}
/**
* @return Collection|TeacherSalary[]
*/
public function getTeacherSalaries(): Collection
{
return $this->teacherSalaries;
}
public function addTeacherSalary(TeacherSalary $teacherSalary): self
{
if ( ! $this->teacherSalaries->contains($teacherSalary)) {
$this->teacherSalaries[] = $teacherSalary;
$teacherSalary->setTeacher($this);
}
return $this;
}
public function removeTeacherSalary(TeacherSalary $teacherSalary): self
{
if ($this->teacherSalaries->contains($teacherSalary)) {
$this->teacherSalaries->removeElement($teacherSalary);
// set the owning side to null (unless already changed)
if ($teacherSalary->getTeacher() === $this) {
$teacherSalary->setTeacher(null);
}
}
return $this;
}
/**
* @return Collection|Homework[]
*/
public function getHomeworks(): Collection
{
return $this->homeworks;
}
public function addHomework(Homework $homework): self
{
if ( ! $this->homeworks->contains($homework)) {
$this->homeworks[] = $homework;
$homework->setCorrectedBy($this);
}
return $this;
}
public function removeHomework(Homework $homework): self
{
if ($this->homeworks->contains($homework)) {
$this->homeworks->removeElement($homework);
// set the owning side to null (unless already changed)
if ($homework->getCorrectedBy() === $this) {
$homework->setCorrectedBy(null);
}
}
return $this;
}
/**
* @return Collection|VideoProgram[]
*/
public function getVideoPrograms(): Collection
{
return $this->videoPrograms;
}
public function addVideoProgram(VideoProgram $videoProgram): self
{
if ( ! $this->videoPrograms->contains($videoProgram)) {
$this->videoPrograms[] = $videoProgram;
$videoProgram->setTeacher($this);
}
return $this;
}
public function removeVideoProgram(VideoProgram $videoProgram): self
{
if ($this->videoPrograms->contains($videoProgram)) {
$this->videoPrograms->removeElement($videoProgram);
// set the owning side to null (unless already changed)
if ($videoProgram->getTeacher() === $this) {
$videoProgram->setTeacher(null);
}
}
return $this;
}
/**
* @return Collection|VideoProgram[]
*/
public function getVideoProgramsCanTeach(): Collection
{
return $this->videoProgramsCanTeach;
}
public function addVideoProgramsCanTeach(VideoProgram $videoProgramsCanTeach): self
{
if ( ! $this->videoProgramsCanTeach->contains($videoProgramsCanTeach)) {
$this->videoProgramsCanTeach[] = $videoProgramsCanTeach;
$videoProgramsCanTeach->addTeacherForLesson($this);
}
return $this;
}
public function removeVideoProgramsCanTeach(VideoProgram $videoProgramsCanTeach): self
{
if ($this->videoProgramsCanTeach->contains($videoProgramsCanTeach)) {
$this->videoProgramsCanTeach->removeElement($videoProgramsCanTeach);
$videoProgramsCanTeach->removeTeacherForLesson($this);
}
return $this;
}
/**
* @return Collection|VideoDividend[]
*/
public function getVideoDividends(): Collection
{
return $this->videoDividends;
}
public function addVideoDividend(VideoDividend $videoDividend): self
{
if ( ! $this->videoDividends->contains($videoDividend)) {
$this->videoDividends[] = $videoDividend;
$videoDividend->setTeacher($this);
}
return $this;
}
public function removeVideoDividend(VideoDividend $videoDividend): self
{
if ($this->videoDividends->contains($videoDividend)) {
$this->videoDividends->removeElement($videoDividend);
// set the owning side to null (unless already changed)
if ($videoDividend->getTeacher() === $this) {
$videoDividend->setTeacher(null);
}
}
return $this;
}
public function getSlackChannel(): ?string
{
return $this->slackChannel;
}
public function setSlackChannel(?string $slackChannel): self
{
if ( ! empty($slackChannel) && substr($slackChannel, 0, 1) !== '#') {
$slackChannel = '#'.$slackChannel;
}
$this->slackChannel = $slackChannel;
return $this;
}
public function getIban(): ?string
{
return $this->iban;
}
public function setIban(?string $iban): self
{
$this->iban = $iban;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): self
{
$this->city = $city;
return $this;
}
public function getZipCode(): ?int
{
return $this->zipCode;
}
public function setZipCode(?int $zipCode): self
{
$this->zipCode = $zipCode;
return $this;
}
public function getCountry(): ?string
{
return $this->country;
}
public function setCountry(?string $country): self
{
$this->country = $country;
return $this;
}
public function getIsActif(): ?bool
{
return $this->isActif;
}
public function setIsActif(?bool $isActif): self
{
$this->isActif = $isActif;
return $this;
}
public function getIsLevelTest(): ?bool
{
return $this->isLevelTest;
}
public function setIsLevelTest(?bool $isLevelTest): self
{
$this->isLevelTest = $isLevelTest;
return $this;
}
public function getIsCamera(): ?bool
{
return $this->isCamera;
}
public function setIsCamera(?bool $isCamera): self
{
$this->isCamera = $isCamera;
return $this;
}
/**
* @return Collection|TrainingReport[]
*/
public function getTrainingReports(): Collection
{
return $this->trainingReports;
}
public function addTrainingReport(TrainingReport $trainingReport): self
{
if (!$this->trainingReports->contains($trainingReport)) {
$this->trainingReports[] = $trainingReport;
$trainingReport->setTeacher($this);
}
return $this;
}
public function removeTrainingReport(TrainingReport $trainingReport): self
{
if ($this->trainingReports->removeElement($trainingReport)) {
// set the owning side to null (unless already changed)
if ($trainingReport->getTeacher() === $this) {
$trainingReport->setTeacher(null);
}
}
return $this;
}
public function getAddonForArabic(): ?float
{
return $this->addonForArabic;
}
public function setAddonForArabic(?float $addonForArabic): self
{
$this->addonForArabic = round($addonForArabic, 2);
return $this;
}
public function getAddonForQuran(): ?float
{
return $this->addonForQuran;
}
public function setAddonForQuran(?float $addonForQuran): self
{
$this->addonForQuran = round($addonForQuran, 2);
return $this;
}
public function getAddonForChildren(): ?float
{
return $this->addonForChildren;
}
public function setAddonForChildren(?float $addonForChildren): self
{
$this->addonForChildren = round($addonForChildren, 2);
return $this;
}
public function getIsBeginner(): ?bool
{
return $this->isBeginner;
}
public function setIsBeginner(?bool $isBeginner): self
{
$this->isBeginner = $isBeginner;
return $this;
}
public function getIsIntermediate(): ?bool
{
return $this->isIntermediate;
}
public function setIsIntermediate(?bool $isIntermediate): self
{
$this->isIntermediate = $isIntermediate;
return $this;
}
public function getIsAdvanced(): ?bool
{
return $this->isAdvanced;
}
public function setIsAdvanced(?bool $isAdvanced): self
{
$this->isAdvanced = $isAdvanced;
return $this;
}
public function getCurrency(): ?string
{
return $this->currency;
}
public function setCurrency(?string $currency): self
{
$this->currency = $currency;
return $this;
}
/**
* @return Collection<int, MainTeacherSalary>
*/
public function getMainTeacherSalaries(): Collection
{
return $this->mainTeacherSalaries;
}
public function addMainTeacherSalary(MainTeacherSalary $mainTeacherSalary): self
{
if (!$this->mainTeacherSalaries->contains($mainTeacherSalary)) {
$this->mainTeacherSalaries[] = $mainTeacherSalary;
$mainTeacherSalary->setTeacher($this);
}
return $this;
}
public function removeMainTeacherSalary(MainTeacherSalary $mainTeacherSalary): self
{
if ($this->mainTeacherSalaries->removeElement($mainTeacherSalary)) {
// set the owning side to null (unless already changed)
if ($mainTeacherSalary->getTeacher() === $this) {
$mainTeacherSalary->setTeacher(null);
}
}
return $this;
}
/**
* @return Collection<int, TeacherLeveltest>
*/
public function getTeacherLeveltests(): Collection
{
return $this->teacherLeveltests;
}
public function addTeacherLeveltest(TeacherLeveltest $teacherLeveltest): self
{
if (!$this->teacherLeveltests->contains($teacherLeveltest)) {
$this->teacherLeveltests[] = $teacherLeveltest;
$teacherLeveltest->setTeacher($this);
}
return $this;
}
public function removeTeacherLeveltest(TeacherLeveltest $teacherLeveltest): self
{
if ($this->teacherLeveltests->removeElement($teacherLeveltest)) {
// set the owning side to null (unless already changed)
if ($teacherLeveltest->getTeacher() === $this) {
$teacherLeveltest->setTeacher(null);
}
}
return $this;
}
public function updateSubjects(): void
{
foreach ($this->getTeacherSubjects() as $teacherSubject) {
if ($teacherSubject->getSubject()->getCategory()->getId() == 1) {
$teacherSubject->setQiraa(null);
}
if ($teacherSubject->getSubject()->getCategory()->getId() == 2) {
$teacherSubject->setFromLevel(null);
$teacherSubject->setToLevel(null);
}
}
}
public function getQiraa(): ?Qiraa
{
return $this->Qiraa;
}
public function setQiraa(?Qiraa $Qiraa): self
{
$this->Qiraa = $Qiraa;
return $this;
}
public function getGroupSalary(): ?float
{
return $this->groupSalary;
}
public function setGroupSalary(?float $groupSalary): self
{
$this->groupSalary = $groupSalary;
return $this;
}
public function getGroupWaitingSalary(): ?float
{
return $this->groupWaitingSalary;
}
public function setGroupWaitingSalary(?float $groupWaitingSalary): self
{
$this->groupWaitingSalary = $groupWaitingSalary;
return $this;
}
}