src/Entity/User.php line 264

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Domain;
  4. use App\Entity\Course;
  5. use App\Entity\SchoolYear;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use App\Entity\Traits\TimeStampable;
  9. use App\Repository\UserRepository;
  10. use App\Entity\Traits\HasUploadableField;
  11. use App\Repository\AttributionRepository;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\Common\Collections\ArrayCollection;
  14. use Symfony\Component\Validator\Constraints as Assert;
  15. use Symfony\Component\Security\Core\User\UserInterface;
  16. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  17. /**
  18.  * @ORM\Entity(repositoryClass=UserRepository::class)
  19.  * @UniqueEntity(fields={"email"}, message="There is already an account with this email")
  20.  * @UniqueEntity(fields={"phoneNumber"}, message="There is already an account with this phone number")
  21.  * @UniqueEntity(fields={"numCni"}, message="There is already an account with this cni number")
  22.  * @ORM\HasLifecycleCallbacks
  23.  * 
  24.  */
  25. class User implements UserInterface//, PasswordAuthenticatedUserInterface
  26. {
  27.     use TimeStampable;
  28.     use HasUploadableField;
  29.     /**
  30.      * @ORM\Id
  31.      * @ORM\GeneratedValue
  32.      * @ORM\Column(type="integer")
  33.      */
  34.     private $id;
  35.     /**
  36.      * @ORM\Column(type="string", length=180, unique=true)
  37.      * @Assert\NotBlank(message="Please enter your email address")
  38.      * @Assert\NotBlank(message="Please enter a valid  email address")
  39.      */
  40.     private $email;
  41.       /** @ORM\Column(name="github_id", type="string", length=255, nullable=true) */
  42.      private $github_id;
  43.     
  44.      /** @ORM\Column(name="github_access_token", type="string", length=255, nullable=true) */
  45.      private $github_access_token;
  46.  
  47.      /** @ORM\Column(name="facebook_id", type="string", length=255, nullable=true) */
  48.      private $facebook_id;
  49.  
  50.      /** @ORM\Column(name="facebook_access_token", type="string", length=255, nullable=true) */
  51.      private $facebook_access_token;
  52.  
  53.      /** @ORM\Column(name="google_id", type="string", length=255, nullable=true) */
  54.      private $google_id;
  55.  
  56.      /** @ORM\Column(name="google_access_token", type="string", length=255, nullable=true) */
  57.      private $google_access_token;
  58.  
  59.      /** @ORM\Column(name="linkedin_id", type="string", length=255, nullable=true) */
  60.      private $linkedin_id;
  61.  
  62.      /** @ORM\Column(name="linkedin_access_token", type="string", length=255, nullable=true) */
  63.      private $linkedin_access_token;
  64.     /** @ORM\Column(name="twitter_id", type="string", length=255, nullable=true) */
  65.     private $twitter_id;
  66.      /** @ORM\Column(name="twitter_access_token", type="string", length=255, nullable=true) */
  67.      private $twitter_access_token;
  68.      /** @ORM\Column(name="yahoo_id", type="string", length=255, nullable=true) */
  69.     private $yahoo_id;
  70.     /** @ORM\Column(name="yahoo_access_token", type="string", length=255, nullable=true) */
  71.     private $yahoo_access_token;
  72.     
  73.     private $roles = [];
  74.     /**
  75.      * @var string The hashed password
  76.      * @ORM\Column(type="string")
  77.      */
  78.     private $password;
  79.       /**
  80.      * @Assert\EqualTo( value="password",
  81.      * message = " Le mot de passe et le mot de passe de verification doivent etre les memes ")
  82.      */
  83.     public $confirm_password;
  84.     /**
  85.      * @ORM\Column(type="boolean")
  86.      */
  87.     private $isVerified false;
  88.       /**
  89.      * @ORM\OneToMany(targetEntity=Email::class, mappedBy="sender")
  90.      */
  91.     private $emails;
  92.   
  93.     
  94.    
  95.       /**
  96.      * @ORM\Column(name="avatarPath", type="string", length=255, nullable=true)
  97.      */
  98.     protected $avatarPath;
  99.    
  100.     /**
  101.      * @var string
  102.      *
  103.      * @ORM\Column(name="phoneNumber", type="string", length=255, nullable=false)
  104.      */
  105.     protected $phoneNumber;
  106.     /** @ORM\Column(name="gender", nullable=true, unique=false, length=10) 
  107.      * @Assert\Choice(
  108.      * choices = { 0, 1 },
  109.      * message = "précisez le sexe")
  110.      */
  111.     protected $gender;
  112.     /**
  113.      * @var \Date
  114.      *
  115.      * @ORM\Column(name="birthday", type="date", nullable=true)
  116.      */
  117.     protected $birthday;
  118.     /**
  119.      * @var string
  120.      *
  121.      * @ORM\Column(name="birthplace", type="string", length=255, nullable=true)
  122.      */
  123.     private $birthplace;
  124.     /**
  125.      * @var string
  126.      *
  127.      * @ORM\Column(name="nationality", type="string", length=255, nullable=true)
  128.      */
  129.     protected $nationality;
  130.     /**
  131.      * @var string
  132.      *
  133.      * @ORM\Column(name="location", type="string", length=255, nullable=true)
  134.      */
  135.     protected $location;
  136.     /** @ORM\Column(name="region", nullable=true, unique=false, length=10) 
  137.      * @Assert\Choice(
  138.      * choices = { "Adamaoua", "Centre" ,"Est", "Extrême-Nord" ,"Littoral", "Nord", "Nord-Ouest" ,"Ouest", "Sud", "Sud-Ouest"},
  139.      * message = "précisez votre region d'origine")
  140.      */
  141.     protected $region;
  142.       /**
  143.      * @var string
  144.      *
  145.      * @ORM\Column(name="department", type="string", length=255, nullable=true)
  146.      */
  147.     protected $department;
  148.     /** @ORM\Column(name="academicLevel", nullable=true, unique=false, length=10) 
  149.      * @Assert\Choice(
  150.      * choices = { "BAC", "LICENCE" ,"DIP1", "DIP2" ,"MASTER", "DOCTORAT"},
  151.      * message = "précisez le niveau académique")
  152.      */
  153.     protected $academicLevel;
  154.     /**
  155.      * @var string
  156.      *
  157.      * @ORM\Column(name="numCni", type="string", length=255, nullable=true, unique=false)
  158.      */
  159.     protected $numCni;
  160.   
  161.     /** @ORM\Column(name="status", nullable=true, unique=false, length=10) 
  162.      * @Assert\Choice(
  163.      * choices = {"ELEVE","ADMIN", "PROF", "FINANCE", "PRINCIPAL", "PREFET"},
  164.      * * message = "précisez votre statu dans ISBB")
  165.      */
  166.     protected $status;
  167.     /**
  168.      * @ORM\ManyToOne(targetEntity=Domain::class, inversedBy="teachers")
  169.      */
  170.     private $domain;
  171.     
  172.       /**
  173.      * @ORM\OneToMany(targetEntity=Domain::class, mappedBy="headOfDepartment")
  174.      */
  175.     private $headOfDepartementOf;
  176.     
  177.     /**
  178.      * @ORM\OneToMany(targetEntity=Attribution::class, mappedBy="teacher")
  179.      */
  180.     private $attributions;
  181.     /**
  182.      * @ORM\OneToMany(targetEntity=MainTeacher::class, mappedBy="teacher")
  183.      */
  184.     private $mainTeachers;
  185.     /**
  186.      * @ORM\Column(type="string", length=255, nullable=true)
  187.      */
  188.     private $fullName;
  189.      /**
  190.      * @ORM\Column(type="string", length=255)
  191.      */
  192.     private $securityQuestion;
  193.     /**
  194.      * @ORM\Column(type="string", length=255,options={"default": "bethesda"})
  195.      */
  196.     private $securityAnswer;
  197.     public function getSecurityQuestion(): ?string
  198.     {
  199.         return $this->securityQuestion;
  200.     }
  201.     public function setSecurityQuestion(string $securityQuestion): self
  202.     {
  203.         $this->securityQuestion $securityQuestion;
  204.         return $this;
  205.     }
  206.     public function getSecurityAnswer(): ?string
  207.     {
  208.         return $this->securityAnswer;
  209.     }
  210.     public function setSecurityAnswer(string $securityAnswer): self
  211.     {
  212.         $this->securityAnswer $securityAnswer;
  213.         return $this;
  214.     }
  215.   
  216.    
  217.     public function getAvatar(int $size 50): ?string
  218.     {
  219.         return "https://www.gravatar.com/avatar/"md5(strtolower(trim($this->getEmail())))."/?s=".$size;
  220.     }
  221.     public function __construct()
  222.     {
  223.         
  224.         $this->emails = new ArrayCollection();
  225.         $this->fullTeacherOf = new ArrayCollection();
  226.         $this->attributions = new ArrayCollection();
  227.         $this->headOfDepartementOf = new ArrayCollection();
  228.         $this->mainTeachers = new ArrayCollection();
  229.     }
  230.     public function getId(): ?int
  231.     {
  232.         return $this->id;
  233.     }
  234.     public function getAvatarPath(): ?string
  235.     {
  236.         return $this->avatarPath;
  237.     }
  238.     public function setAvatarPath(?string $imageName): self
  239.     {
  240.         $this->avatarPath $imageName;
  241.         return $this;
  242.     }
  243.    
  244.     public function __toString() {
  245.         $username = ( is_null($this->getFullName())) ? "" $this->getFullName();
  246.         return $username;
  247.     }
  248.     public function getEmail(): ?string
  249.     {
  250.         return $this->email;
  251.     }
  252.     public function setEmail(string $email): self
  253.     {
  254.         $this->email $email;
  255.         return $this;
  256.     }
  257.     /**
  258.      * A visual identifier that represents this user.
  259.      *
  260.      * @see UserInterface
  261.      */
  262.     public function getUsername(): string
  263.     {
  264.         return (string) $this->email;
  265.     }
  266.     /**
  267.      * @see UserInterface
  268.      */
  269.     public function getRoles(): array
  270.     {
  271.         $roles $this->roles;
  272.         // guarantee every user at least has ROLE_USER
  273.         // $roles[] = 'ROLE_USER';
  274.         //$roles[] = 'ROLE_ADMIN';
  275.         switch ($this->getStatus()) {
  276.             case "PROF":
  277.                 $roles[] = 'ROLE_USER';
  278.             break;
  279.             case "ADMIN":
  280.                 $roles[] = 'ROLE_USER';
  281.                 $roles[] = 'ROLE_ADMIN';
  282.             break;
  283.             case "DISCIPLINE":
  284.                 $roles[] = 'ROLE_USER';
  285.                 $roles[] = 'ROLE_DISCIPLINE';
  286.             break;
  287.             case "FINANCIAL":
  288.                 $roles[] = 'ROLE_USER';
  289.                 $roles[] = 'ROLE_FINANCIAL';
  290.             break;
  291.             default:
  292.                 $roles[] = 'ROLE_USER';
  293.             break;
  294.           }
  295.         return array_unique($roles);
  296.     }
  297.     public function setRoles(array $roles): self
  298.     {
  299.         $this->roles $roles;
  300.         return $this;
  301.     }
  302.     /**
  303.      * @see UserInterface
  304.      */
  305.     public function getPassword(): string
  306.     {
  307.         return $this->password;
  308.     }
  309.     public function setPassword(string $password): self
  310.     {
  311.         $this->password $password;
  312.         return $this;
  313.     }
  314.     /**
  315.      * Returning a salt is only needed, if you are not using a modern
  316.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  317.      *
  318.      * @see UserInterface
  319.      */
  320.     public function getSalt(): ?string
  321.     {
  322.         return null;
  323.     }
  324.     public function addRole($role): self
  325.     {
  326.         array_push($this->roles$role);
  327.         $this->setRoles(array_unique($this->roles));
  328.         return $this;
  329.     }
  330.     /**
  331.      * @see UserInterface
  332.      */
  333.     public function eraseCredentials()
  334.     {
  335.         // If you store any temporary, sensitive data on the user, clear it here
  336.         // $this->plainPassword = null;
  337.     }
  338.     public function isVerified(): bool
  339.     {
  340.         return $this->isVerified;
  341.     }
  342.     public function toggleIsVerified(): self
  343.     {
  344.          $this->isVerified = !$this->isVerified;
  345.          return $this;
  346.     }
  347.     public function setIsVerified(bool $isVerified): self
  348.     {
  349.         $this->isVerified $isVerified;
  350.         return $this;
  351.     }
  352.     public function getPhoneNumber(): ?string
  353.     {
  354.         return $this->phoneNumber;
  355.     }
  356.     public function setPhoneNumber(string $phone): self
  357.     {
  358.         $this->phoneNumber $phone;
  359.         return $this;
  360.     }
  361.      /**
  362.      * 
  363.      *
  364.      * @return string
  365.      */
  366.     public function getStatus() {
  367.         return $this->status;
  368.     }
  369.     public function setStatus($email) {
  370.         if (!empty($email))
  371.             $this->status $email;
  372.         return $this;
  373.     }
  374.       /**
  375.      * Set birthplace
  376.      *
  377.      * @param string $birthplace
  378.      *
  379.      * @return User
  380.      */
  381.     public function setBirthplace($birthplace)
  382.     {
  383.         $this->birthplace $birthplace;
  384.         return $this;
  385.     }
  386.     /**
  387.      * Get birthplace
  388.      *
  389.      * @return string
  390.      */
  391.     public function getBirthplace()
  392.     {
  393.         return $this->birthplace;
  394.     }
  395.      /**
  396.      * Set birthday
  397.      *
  398.      * @param \DateTime $birthday
  399.      *
  400.      * @return User
  401.      */
  402.     public function setBirthday($birthday)
  403.     {
  404.         $this->birthday $birthday;
  405.         return $this;
  406.     }
  407.     /**
  408.      * Get birthday
  409.      *
  410.      * @return \DateTime
  411.      */
  412.     public function getBirthday()
  413.     {
  414.         return $this->birthday;
  415.     }
  416.      /**
  417.      * Set gender
  418.      *
  419.      * @param string $gender
  420.      *
  421.      * @return User
  422.      */
  423.     public function setGender($gender) {
  424.         $this->gender $gender;
  425.         return $this;
  426.     }
  427.     /**
  428.      * Get gender
  429.      *
  430.      * @return string
  431.      */
  432.     public function getGender() {
  433.         return $this->gender;
  434.     }
  435.      /**
  436.      * Set nationality
  437.      *
  438.      * @param string $nationality
  439.      *
  440.      * @return User
  441.      */
  442.     public function setNationality($nationality) {
  443.         $this->nationality $nationality;
  444.         return $this;
  445.     }
  446.     /**
  447.      * Get nationality
  448.      *
  449.      * @return string
  450.      */
  451.     public function getNationality() {
  452.         return $this->nationality;
  453.     }
  454.     /**
  455.      * Set location
  456.      *
  457.      * @param string $location
  458.      *
  459.      * @return User
  460.      */
  461.     public function setLocation($location) {
  462.         $this->location $location;
  463.         return $this;
  464.     }
  465.     /**
  466.      * Get location
  467.      *
  468.      * @return string
  469.      */
  470.     public function getLocation() {
  471.         return $this->location;
  472.     }
  473.     /**
  474.      * Set academicLevel
  475.      *
  476.      * @param string $academicLevel
  477.      *
  478.      * @return User
  479.      */
  480.     public function setAcademicLevel($academicLevel) {
  481.         $this->academicLevel $academicLevel;
  482.         return $this;
  483.     }
  484.     /**
  485.      * Get academicLevel
  486.      *
  487.      * @return string
  488.      */
  489.     public function getAcademicLevel() {
  490.         return $this->academicLevel;
  491.     }
  492.     /**
  493.      * Set numCni
  494.      *
  495.      * @param string $numCni
  496.      *
  497.      * @return User
  498.      */
  499.     public function setNumCni($numCni) {
  500.         $this->numCni $numCni;
  501.         return $this;
  502.     }
  503.     /**
  504.      * Get numCni
  505.      *
  506.      * @return string
  507.      */
  508.     public function getNumCni() {
  509.         return $this->numCni;
  510.     }
  511.      /**
  512.      * Set domain
  513.      *
  514.      * @param \App\Entity\Domain $domain
  515.      *
  516.      * @return User
  517.      */
  518.     public function setDomain(Domain $domain null) {
  519.         $this->domain $domain;
  520.         return $this;
  521.     }
  522.     /**
  523.      * Get domain
  524.      *
  525.      * @return \App\Entity\Domain
  526.      */
  527.     public function getDomain() {
  528.         return $this->domain;
  529.     }
  530.     /**
  531.      * @return Collection|ClassRoom[]
  532.      */
  533.     public function getFullTeacherOf(): Collection
  534.     {
  535.         return $this->fullTeacherOf;
  536.     }
  537.     public function addFullTeacherOf(ClassRoom $fullTeacherOf): self
  538.     {
  539.         if (!$this->fullTeacherOf->contains($fullTeacherOf)) {
  540.             $this->fullTeacherOf[] = $fullTeacherOf;
  541.             $fullTeacherOf->setFullTeacher($this);
  542.         }
  543.         return $this;
  544.     }
  545.     public function removeFullTeacherOf(ClassRoom $fullTeacherOf): self
  546.     {
  547.         if ($this->fullTeacherOf->removeElement($fullTeacherOf)) {
  548.             // set the owning side to null (unless already changed)
  549.             if ($fullTeacherOf->getFullTeacher() === $this) {
  550.                 $fullTeacherOf->setFullTeacher(null);
  551.             }
  552.         }
  553.         return $this;
  554.     }
  555.     public function getUsernameCanonical(): ?string
  556.     {
  557.         return $this->username_canonical;
  558.     }
  559.     public function setUsernameCanonical(string $username_canonical): self
  560.     {
  561.         $this->username_canonical $username_canonical;
  562.         return $this;
  563.     }
  564.     public function getEmailCanonical(): ?string
  565.     {
  566.         return $this->email_canonical;
  567.     }
  568.     public function setEmailCanonical(string $email_canonical): self
  569.     {
  570.         $this->email_canonical $email_canonical;
  571.         return $this;
  572.     }
  573.     public function getEnabled(): ?bool
  574.     {
  575.         return $this->enabled;
  576.     }
  577.     public function setEnabled(bool $enabled): self
  578.     {
  579.         $this->enabled $enabled;
  580.         return $this;
  581.     }
  582.     public function setSalt(?string $salt): self
  583.     {
  584.         $this->salt $salt;
  585.         return $this;
  586.     }
  587.     public function getLastLogin(): ?\DateTimeInterface
  588.     {
  589.         return $this->last_login;
  590.     }
  591.     public function setLastLogin(?\DateTimeInterface $last_login): self
  592.     {
  593.         $this->last_login $last_login;
  594.         return $this;
  595.     }
  596.     public function getConfirmationToken(): ?string
  597.     {
  598.         return $this->confirmation_token;
  599.     }
  600.     public function setConfirmationToken(?string $confirmation_token): self
  601.     {
  602.         $this->confirmation_token $confirmation_token;
  603.         return $this;
  604.     }
  605.     public function getPasswordRequestedAt(): ?\DateTimeImmutable
  606.     {
  607.         return $this->password_requested_at;
  608.     }
  609.     public function setPasswordRequestedAt(?\DateTimeImmutable $password_requested_at): self
  610.     {
  611.         $this->password_requested_at $password_requested_at;
  612.         return $this;
  613.     }
  614.     public function getFullName(): ?string
  615.     {
  616.         return $this->fullName;
  617.     }
  618.     public function setFullName(?string $fullName): self
  619.     {
  620.         $this->fullName $fullName;
  621.         return $this;
  622.     }
  623.     public function getGithubId(): ?string
  624.     {
  625.         return $this->github_id;
  626.     }
  627.     public function setGithubId(?string $github_id): self
  628.     {
  629.         $this->github_id $github_id;
  630.         return $this;
  631.     }
  632.     public function getGithubAccessToken(): ?string
  633.     {
  634.         return $this->github_access_token;
  635.     }
  636.     public function setGithubAccessToken(?string $github_access_token): self
  637.     {
  638.         $this->github_access_token $github_access_token;
  639.         return $this;
  640.     }
  641.     public function getFacebookId(): ?string
  642.     {
  643.         return $this->facebook_id;
  644.     }
  645.     public function setFacebookId(?string $facebook_id): self
  646.     {
  647.         $this->facebook_id $facebook_id;
  648.         return $this;
  649.     }
  650.     public function getFacebookAccessToken(): ?string
  651.     {
  652.         return $this->facebook_access_token;
  653.     }
  654.     public function setFacebookAccessToken(?string $facebook_access_token): self
  655.     {
  656.         $this->facebook_access_token $facebook_access_token;
  657.         return $this;
  658.     }
  659.     public function getGoogleId(): ?string
  660.     {
  661.         return $this->google_id;
  662.     }
  663.     public function setGoogleId(?string $google_id): self
  664.     {
  665.         $this->google_id $google_id;
  666.         return $this;
  667.     }
  668.     public function getGoogleAccessToken(): ?string
  669.     {
  670.         return $this->google_access_token;
  671.     }
  672.     public function setGoogleAccessToken(?string $google_access_token): self
  673.     {
  674.         $this->google_access_token $google_access_token;
  675.         return $this;
  676.     }
  677.     public function getLinkedinId(): ?string
  678.     {
  679.         return $this->linkedin_id;
  680.     }
  681.     public function setLinkedinId(?string $linkedin_id): self
  682.     {
  683.         $this->linkedin_id $linkedin_id;
  684.         return $this;
  685.     }
  686.     public function getLinkedinAccessToken(): ?string
  687.     {
  688.         return $this->linkedin_access_token;
  689.     }
  690.     public function setLinkedinAccessToken(?string $linkedin_access_token): self
  691.     {
  692.         $this->linkedin_access_token $linkedin_access_token;
  693.         return $this;
  694.     }
  695.     public function getTwitterId(): ?string
  696.     {
  697.         return $this->twitter_id;
  698.     }
  699.     public function setTwitterId(?string $twitter_id): self
  700.     {
  701.         $this->twitter_id $twitter_id;
  702.         return $this;
  703.     }
  704.     public function getTwitterAccessToken(): ?string
  705.     {
  706.         return $this->twitter_access_token;
  707.     }
  708.     public function setTwitterAccessToken(?string $twitter_access_token): self
  709.     {
  710.         $this->twitter_access_token $twitter_access_token;
  711.         return $this;
  712.     }
  713.     public function getYahooId(): ?string
  714.     {
  715.         return $this->yahoo_id;
  716.     }
  717.     public function setYahooId(?string $yahoo_id): self
  718.     {
  719.         $this->yahoo_id $yahoo_id;
  720.         return $this;
  721.     }
  722.     public function getYahooAccessToken(): ?string
  723.     {
  724.         return $this->yahoo_access_token;
  725.     }
  726.     public function setYahooAccessToken(?string $yahoo_access_token): self
  727.     {
  728.         $this->yahoo_access_token $yahoo_access_token;
  729.         return $this;
  730.     }
  731.     public function getIsVerified(): ?bool
  732.     {
  733.         return $this->isVerified;
  734.     }
  735.     /**
  736.      * @return Collection|Email[]
  737.      */
  738.     public function getEmails(): Collection
  739.     {
  740.         return $this->emails;
  741.     }
  742.     public function addEmail(Email $email): self
  743.     {
  744.         if (!$this->emails->contains($email)) {
  745.             $this->emails[] = $email;
  746.             $email->setSender($this);
  747.         }
  748.         return $this;
  749.     }
  750.     public function removeEmail(Email $email): self
  751.     {
  752.         if ($this->emails->removeElement($email)) {
  753.             // set the owning side to null (unless already changed)
  754.             if ($email->getSender() === $this) {
  755.                 $email->setSender(null);
  756.             }
  757.         }
  758.         return $this;
  759.     }
  760.     /**
  761.      * @return Collection|Attribution[]
  762.      */
  763.     public function getAttributions(): Collection
  764.     {
  765.         return $this->attributions;
  766.     }
  767.     /**
  768.      * list of courses assigned to a teacher during a given year
  769.      */
  770.     public function getCourses(SchoolYear $year)
  771.     {
  772.         $courses = [];
  773.         foreach($this->attributions as $attribution){
  774.             if($attribution->getSchoolYear()==$year){
  775.                 $courses[] = $attribution->getCourse();
  776.             }
  777.         }
  778.         return $courses;
  779.     }
  780.     public function addAttribution(Attribution $attribution): self
  781.     {
  782.         if (!$this->attributions->contains($attribution)) {
  783.             $this->attributions[] = $attribution;
  784.             $attribution->setTeacher($this);
  785.         }
  786.         return $this;
  787.     }
  788.     public function removeAttribution(Attribution $attribution): self
  789.     {
  790.         if ($this->attributions->removeElement($attribution)) {
  791.             // set the owning side to null (unless already changed)
  792.             if ($attribution->getTeacher() === $this) {
  793.                  
  794.             }
  795.         }
  796.         return $this;
  797.     }
  798.     public function getUserIdentifier() {
  799.       return $this->getEmail();
  800.     }
  801.     public function isIsVerified(): ?bool
  802.     {
  803.         return $this->isVerified;
  804.     }
  805.  
  806.     public function getDepartment(): ?string
  807.     {
  808.         return $this->department;
  809.     }
  810.     public function setDepartment(?string $department): static
  811.     {
  812.         $this->department $department;
  813.         return $this;
  814.     }
  815.     public function getRegion(): ?string
  816.     {
  817.         return $this->region;
  818.     }
  819.     public function setRegion(?string $region): static
  820.     {
  821.         $this->region $region;
  822.         return $this;
  823.     }
  824.     /**
  825.      * @return Collection<int, Domain>
  826.      */
  827.     public function getHeadOfDepartementOf(): Collection
  828.     {
  829.         return $this->headOfDepartementOf;
  830.     }
  831.     public function addHeadOfDepartementOf(Domain $headOfDepartementOf): static
  832.     {
  833.         if (!$this->headOfDepartementOf->contains($headOfDepartementOf)) {
  834.             $this->headOfDepartementOf->add($headOfDepartementOf);
  835.             $headOfDepartementOf->setHeadOfDepartment($this);
  836.         }
  837.         return $this;
  838.     }
  839.     public function removeHeadOfDepartementOf(Domain $headOfDepartementOf): static
  840.     {
  841.         if ($this->headOfDepartementOf->removeElement($headOfDepartementOf)) {
  842.             // set the owning side to null (unless already changed)
  843.             if ($headOfDepartementOf->getHeadOfDepartment() === $this) {
  844.                 $headOfDepartementOf->setHeadOfDepartment(null);
  845.             }
  846.         }
  847.         return $this;
  848.     }
  849.     /**
  850.      * @return Collection<int, MainTeacher>
  851.      */
  852.     public function getMainTeachers(): Collection
  853.     {
  854.         return $this->mainTeachers;
  855.     }
  856.     public function addMainTeacher(MainTeacher $mainTeacher): static
  857.     {
  858.         if (!$this->mainTeachers->contains($mainTeacher)) {
  859.             $this->mainTeachers->add($mainTeacher);
  860.             $mainTeacher->setTeacher($this);
  861.         }
  862.         return $this;
  863.     }
  864.     public function removeMainTeacher(MainTeacher $mainTeacher): static
  865.     {
  866.         if ($this->mainTeachers->removeElement($mainTeacher)) {
  867.             // set the owning side to null (unless already changed)
  868.             if ($mainTeacher->getTeacher() === $this) {
  869.                 $mainTeacher->setTeacher(null);
  870.             }
  871.         }
  872.         return $this;
  873.     }
  874.   
  875. }