src/Entity/User.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserRepository;
  4. use DateTimeImmutable;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Form\Exception\InvalidArgumentException;
  9. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  10. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  11. use Symfony\Component\Security\Core\User\UserInterface;
  12. use Symfony\Component\Serializer\Annotation\Groups;
  13. #[ORM\Entity(repositoryClass: UserRepository::class)]
  14. #[UniqueEntity(fields: ['email'], message: 'There is already an account with this email')]
  15. #[ORM\HasLifecycleCallbacks]
  16. #[UniqueEntity(fields: ['email'], message: 'There is already an account with this email')]
  17. class User implements UserInterface, PasswordAuthenticatedUserInterface
  18. {
  19.     #[ORM\Id]
  20.     #[ORM\GeneratedValue]
  21.     #[ORM\Column(type: 'integer')]
  22.     #[Groups(['user:read', 'membre:read', 'meetParticipant:read','task:read'])]
  23.     private ?int $id;
  24.     #[ORM\Column(type: 'string', length: 180, unique: true)]
  25.     #[Groups(['user:read',  'membre:read', 'meetParticipant:read', 'task:read','documentProjet:read'])]
  26.     private ?string $email;
  27.     #[ORM\Column(type: 'json')]
  28.     #[Groups(['user:read', 'task:read'])]
  29.     private array $roles = [];
  30.     #[ORM\Column(type: 'string')]
  31.     private string $password;
  32.     #[ORM\Column(type: 'boolean')]
  33.     private bool $isVerified = false;
  34.     #[ORM\Column(type: 'boolean')]
  35.     private bool $isEnabled = true;
  36.     #[ORM\Column(type: 'string', length: 30)]
  37.     #[Groups(['user:read'])]
  38.     private ?string $gender;
  39.     #[ORM\Column(type: 'string', length: 255)]
  40.     #[Groups(['user:read', 'membre:read', 'meetParticipant:read', 'task:read'])]
  41.     private ?string $firstname;
  42.     #[ORM\Column(type: 'string', length: 255)]
  43.     #[Groups(['user:read', 'membre:read','meetParticipant:read', 'task:read'])]
  44.     private ?string $lastname;
  45.     #[ORM\Column(type: 'string', length: 30)]
  46.     #[Groups(['user:read', 'membre:read', 'meetParticipant:read','task:read'])]
  47.     private ?string $phone;
  48.     #[ORM\Column(type: 'datetime_immutable', nullable: true)]
  49.     private ?DateTimeImmutable $lastLoginAt;
  50.     #[ORM\Column(type: 'string', length: 255, nullable: true)]
  51.     private ?string $createdBy;
  52.     #[ORM\Column(type: 'string', length: 255, nullable: true)]
  53.     private ?string $updatedBy;
  54.     #[ORM\Column(type: 'string', length: 255, nullable: true)]
  55.     private ?string $address;
  56.     #[ORM\Column(type: 'string', length: 45, nullable: true)]
  57.     private ?string $district;
  58. /*
  59.     #[ORM\ManyToOne(targetEntity: Municipality::class, inversedBy: 'users')]
  60.     #[ORM\JoinColumn(nullable: true)]
  61.     private mixed $municipality;
  62. */
  63.     #[ORM\ManyToOne]
  64.     #[ORM\JoinColumn(nullable: true)]
  65.     private ?Municipality $municipality = null;
  66.     #[ORM\ManyToOne]
  67.     #[Groups(['user:read', 'membre:read', 'meetParticipant:read'])]
  68.     private ?Structure $structure = null;
  69.     #[ORM\Column]
  70.     private ?DateTimeImmutable $createdAt = null;
  71.     #[ORM\Column(nullable: true)]
  72.     private ?DateTimeImmutable $updatedAt = null;
  73.     #[ORM\ManyToOne(inversedBy: 'user')]
  74.     private ?Sectoral $sectoral = null;
  75.     #[ORM\Column(length: 255, nullable: true)]
  76.     #[Groups(['user:read', 'membre:read', 'meetParticipant:read'])]
  77.     private ?string $fonction = null;
  78.     private string $plainPassword;
  79.     #[ORM\ManyToMany(targetEntity: Decision::class, mappedBy: 'monitoringOfficer')]
  80.     private Collection $decisions;
  81.     #[ORM\Column(length: 255, nullable: true)]
  82.     #[Groups(['user:read', 'membre:read', 'meetParticipant:read'])]
  83.     private ?string $avatar = null;
  84.     #[ORM\Column(nullable: true)]
  85.     private ?\DateTimeImmutable $mailSentAt = null;
  86.     #[ORM\OneToMany(mappedBy: 'participants', targetEntity: MeetParticipant::class)]
  87.     private Collection $meetParticipants;
  88.     #[ORM\OneToMany(mappedBy: 'gestionnaire', targetEntity: Projet::class)]
  89.     private Collection $projets;
  90.     #[ORM\OneToMany(mappedBy: 'user', targetEntity: ProjetMembre::class)]
  91.     private Collection $projetMembres;
  92.     #[ORM\OneToMany(mappedBy: 'user', targetEntity: TaskAssign::class)]
  93.     private Collection $taskAssigns;
  94.     #[ORM\OneToMany(mappedBy: 'author', targetEntity: Comment::class)]
  95.     private Collection $comments;
  96.     #[ORM\OneToMany(mappedBy: 'createdBy', targetEntity: Bailleur::class)]
  97.     private Collection $bailleurs;
  98.     #[ORM\OneToMany(mappedBy: 'createdBy', targetEntity: CategorieProjet::class)]
  99.     private Collection $categorieProjets;
  100.     #[ORM\OneToMany(mappedBy: 'createdBy', targetEntity: ModeFinance::class)]
  101.     private Collection $modeFinances;
  102.     #[ORM\OneToMany(mappedBy: 'createdBy', targetEntity: Priority::class)]
  103.     private Collection $priorities;
  104.     #[ORM\OneToMany(mappedBy: 'createdBy', targetEntity: Structure::class)]
  105.     private Collection $structures;
  106.     #[ORM\OneToMany(mappedBy: 'author', targetEntity: RateOfProgress::class)]
  107.     private Collection $rateOfProgress;
  108.     #[ORM\OneToMany(mappedBy: 'author', targetEntity: RejectEvaluation::class)]
  109.     private Collection $rejectEvaluations;
  110.     #[ORM\OneToMany(mappedBy: 'author', targetEntity: Document::class)]
  111.     private Collection $documents;
  112.     #[ORM\OneToMany(mappedBy: 'createdBy', targetEntity: Pao::class)]
  113.     private Collection $paos;
  114.     #[ORM\OneToMany(mappedBy: 'createdBy', targetEntity: Objectif::class)]
  115.     private Collection $objectifs;
  116.     #[ORM\OneToMany(mappedBy: 'createdBy', targetEntity: Activity::class)]
  117.     private Collection $activities;
  118.     #[ORM\OneToMany(mappedBy: 'createdBy', targetEntity: Evaluation::class)]
  119.     private Collection $evaluations;
  120.     #[ORM\OneToMany(mappedBy: 'createdBy', targetEntity: EvaluationCritere::class)]
  121.     private Collection $evaluationCriteres;   
  122.     #[ORM\OneToMany(mappedBy: 'user', targetEntity: Meeting::class)]
  123.     private Collection $meetings;
  124.     
  125.     public function __construct()
  126.     {
  127.         $this->createdAt = new DateTimeImmutable();
  128.         $this->updatedAt = new DateTimeImmutable();
  129.         $this->decisions = new ArrayCollection();
  130.         $this->meetParticipants = new ArrayCollection();
  131.         $this->projets = new ArrayCollection();
  132.         $this->projetMembres = new ArrayCollection();
  133.         $this->taskAssigns = new ArrayCollection();
  134.         $this->comments = new ArrayCollection();
  135.         $this->bailleurs = new ArrayCollection();
  136.         $this->categorieProjets = new ArrayCollection();
  137.         $this->modeFinances = new ArrayCollection();
  138.         $this->priorities = new ArrayCollection();
  139.         $this->structures = new ArrayCollection();
  140.         $this->rateOfProgress = new ArrayCollection();
  141.         $this->rejectEvaluations = new ArrayCollection();
  142.         $this->documents = new ArrayCollection();
  143.         $this->paos = new ArrayCollection();
  144.         $this->objectifs = new ArrayCollection();
  145.         $this->activities = new ArrayCollection();
  146.         $this->evaluations = new ArrayCollection();
  147.         $this->evaluationCriteres = new ArrayCollection();
  148.         $this->meetings = new ArrayCollection();
  149.     }
  150.     public function getId(): ?int
  151.     {
  152.         return $this->id;
  153.     }
  154.     public function getMeetings(): Collection
  155.     {
  156.         return $this->meetings;
  157.     }
  158.     public function getEmail(): ?string
  159.     {
  160.         return $this->email;
  161.     }
  162.     public function setEmail(string $email): self
  163.     {
  164.         $this->email = $email;
  165.         return $this;
  166.     }
  167.     /**
  168.      * A visual identifier that represents this user.
  169.      *
  170.      * @see UserInterface
  171.      */
  172.     public function getUserIdentifier(): string
  173.     {
  174.         return (string) $this->email;
  175.     }
  176.     /**
  177.      * @see UserInterface
  178.      */
  179.     public function getRoles(): array
  180.     {
  181.         $roles = $this->roles;
  182.         // guarantee every user at least has ROLE_USER
  183.         $roles[] = 'ROLE_USER';
  184.         return array_unique($roles);
  185.     }
  186.     public function setRoles(array $roles): self
  187.     {
  188.         foreach ($roles as $role)
  189.         {
  190.             if(!str_starts_with($role, 'ROLE_') ||
  191.                 !in_array($role, ['ROLE_AGENT_MANAGER', 'ROLE_FONCTIONNAIRE', 'ROLE_MANAGER', 'ROLE_SUPERVISEUR']))
  192.             {
  193.                 throw new InvalidArgumentException("Le rôle doit être 'ROLE_FONCTIONNAIRE' ou 'ROLE_MANAGER' ou 'ROLE_SUPERVISEUR' ou commencé par ROLE_");
  194.             }
  195.         }
  196.         $this->roles = $roles;
  197.         return $this;
  198.     }
  199.     /**
  200.      * @see PasswordAuthenticatedUserInterface
  201.      */
  202.     public function getPassword(): string
  203.     {
  204.         return $this->password;
  205.     }
  206.     public function setPassword(string $password): self
  207.     {
  208.         $this->password = $password;
  209.         return $this;
  210.     }
  211.     /**
  212.      * @see UserInterface
  213.      */
  214.     public function eraseCredentials()
  215.     {
  216.         // If you store any temporary, sensitive data on the user, clear it here
  217.         // $this->plainPassword = null;
  218.     }
  219.     public function isVerified(): bool
  220.     {
  221.         return $this->isVerified;
  222.     }
  223.     public function setIsVerified(bool $isVerified): self
  224.     {
  225.         $this->isVerified = $isVerified;
  226.         return $this;
  227.     }
  228.     public function isIsEnabled(): ?bool
  229.     {
  230.         return $this->isEnabled;
  231.     }
  232.     public function setIsEnabled(bool $isEnabled): self
  233.     {
  234.         $this->isEnabled = $isEnabled;
  235.         return $this;
  236.     }
  237.     public function getGender(): ?string
  238.     {
  239.         return $this->gender;
  240.     }
  241.     public function setGender(string $gender): self
  242.     {
  243.         $this->gender = $gender;
  244.         return $this;
  245.     }
  246.     public function getFirstname(): ?string
  247.     {
  248.         return $this->firstname;
  249.     }
  250.     public function setFirstname(string $firstname): self
  251.     {
  252.         $this->firstname = $firstname;
  253.         return $this;
  254.     }
  255.     public function getLastname(): ?string
  256.     {
  257.         return $this->lastname;
  258.     }
  259.     public function setLastname(string $lastname): self
  260.     {
  261.         $this->lastname = $lastname;
  262.         return $this;
  263.     }
  264.     public function getPhone(): ?string
  265.     {
  266.         return $this->phone;
  267.     }
  268.     public function setPhone(string $phone): self
  269.     {
  270.         $this->phone = $phone;
  271.         return $this;
  272.     }
  273.     public function getLastLoginAt(): ?DateTimeImmutable
  274.     {
  275.         return $this->lastLoginAt;
  276.     }
  277.     public function setLastLoginAt(?DateTimeImmutable $lastLoginAt): self
  278.     {
  279.         $this->lastLoginAt = $lastLoginAt;
  280.         return $this;
  281.     }
  282.     public function getCreatedBy(): ?string
  283.     {
  284.         return $this->createdBy;
  285.     }
  286.     public function setCreatedBy(?string $createdBy): self
  287.     {
  288.         $this->createdBy = $createdBy;
  289.         return $this;
  290.     }
  291.     public function getUpdatedBy(): ?string
  292.     {
  293.         return $this->updatedBy;
  294.     }
  295.     public function setUpdatedBy(?string $updatedBy): self
  296.     {
  297.         $this->updatedBy = $updatedBy;
  298.         return $this;
  299.     }
  300.     public function isIsVerified(): ?bool
  301.     {
  302.         return $this->isVerified;
  303.     }
  304.     public function getAddress(): ?string
  305.     {
  306.         return $this->address;
  307.     }
  308.     public function setAddress(string $address): self
  309.     {
  310.         $this->address = $address;
  311.         return $this;
  312.     }
  313.     public function getDistrict(): ?string
  314.     {
  315.         return $this->district;
  316.     }
  317.     public function setDistrict(?string $district): self
  318.     {
  319.         $this->district = $district;
  320.         return $this;
  321.     }
  322.     /**
  323.      * @return mixed
  324.      */
  325.     public function getMunicipality(): mixed
  326.     {
  327.         return $this->municipality;
  328.     }
  329.     /**
  330.      * @param mixed $municipality
  331.      */
  332.     public function setMunicipality($municipality)
  333.     {
  334.         $this->municipality = $municipality;
  335.     }
  336.     public function getStructure(): ?Structure
  337.     {
  338.         return $this->structure;
  339.     }
  340.     public function setStructure(?Structure $structure): self
  341.     {
  342.         $this->structure = $structure;
  343.         return $this;
  344.     }
  345.     public function getCreatedAt(): ?DateTimeImmutable
  346.     {
  347.         return $this->createdAt;
  348.     }
  349.     public function setCreatedAt(DateTimeImmutable $createdAt): self
  350.     {
  351.         $this->createdAt = $createdAt;
  352.         return $this;
  353.     }
  354.     public function getUpdatedAt(): ?DateTimeImmutable
  355.     {
  356.         return $this->updatedAt;
  357.     }
  358.     public function setUpdatedAt(?DateTimeImmutable $updatedAt): self
  359.     {
  360.         $this->updatedAt = $updatedAt;
  361.         return $this;
  362.     }
  363.     public function getSectoral(): ?Sectoral
  364.     {
  365.         return $this->sectoral;
  366.     }
  367.     public function setSectoral(?Sectoral $sectoral): self
  368.     {
  369.         $this->sectoral = $sectoral;
  370.         return $this;
  371.     }
  372.     public function getFonction(): ?string
  373.     {
  374.         return $this->fonction;
  375.     }
  376.     public function setFonction(?string $fonction): self
  377.     {
  378.         $this->fonction = $fonction;
  379.         return $this;
  380.     }
  381.     /**
  382.      * @return string
  383.      */
  384.     public function getPlainPassword(): string
  385.     {
  386.         return $this->plainPassword;
  387.     }
  388.     /**
  389.      * @param string $plainPassword
  390.      */
  391.     public function setPlainPassword(string $plainPassword): void
  392.     {
  393.         $this->plainPassword = $plainPassword;
  394.     }
  395.     /**
  396.      * @return Collection<int, Decision>
  397.      */
  398.     public function getDecisions(): Collection
  399.     {
  400.         return $this->decisions;
  401.     }
  402.     public function addDecision(Decision $decision): self
  403.     {
  404.         if (!$this->decisions->contains($decision)) {
  405.             $this->decisions->add($decision);
  406.             $decision->addMonitoringOfficer($this);
  407.         }
  408.         return $this;
  409.     }
  410.     public function removeDecision(Decision $decision): self
  411.     {
  412.         if ($this->decisions->removeElement($decision)) {
  413.             $decision->removeMonitoringOfficer($this);
  414.         }
  415.         return $this;
  416.     }
  417.     public function getAvatar(): ?string
  418.     {
  419.         return $this->avatar;
  420.     }
  421.     public function setAvatar(?string $avatar): self
  422.     {
  423.         $this->avatar = $avatar;
  424.         return $this;
  425.     }
  426.     public function getMailSentAt(): ?\DateTimeImmutable
  427.     {
  428.         return $this->mailSentAt;
  429.     }
  430.     public function setMailSentAt(?\DateTimeImmutable $mailSentAt): self
  431.     {
  432.         $this->mailSentAt = $mailSentAt;
  433.         return $this;
  434.     }
  435.     /**
  436.      * @return Collection<int, MeetParticipant>
  437.      */
  438.     public function getMeetParticipants(): Collection
  439.     {
  440.         return $this->meetParticipants;
  441.     }
  442.     public function addMeetParticipant(MeetParticipant $meetParticipant): self
  443.     {
  444.         if (!$this->meetParticipants->contains($meetParticipant)) {
  445.             $this->meetParticipants->add($meetParticipant);
  446.             $meetParticipant->setParticipants($this);
  447.         }
  448.         return $this;
  449.     }
  450.     public function removeMeetParticipant(MeetParticipant $meetParticipant): self
  451.     {
  452.         if ($this->meetParticipants->removeElement($meetParticipant)) {
  453.             // set the owning side to null (unless already changed)
  454.             if ($meetParticipant->getParticipants() === $this) {
  455.                 $meetParticipant->setParticipants(null);
  456.             }
  457.         }
  458.         return $this;
  459.     }
  460.     public function __toString(): string 
  461.     {
  462.         return $this->firstname." ".$this->lastname." (".$this->phone.")";
  463.     }
  464.     /**
  465.      * @return Collection<int, Projet>
  466.      */
  467.     public function getProjets(): Collection
  468.     {
  469.         return $this->projets;
  470.     }
  471.     public function addProjet(Projet $projet): self
  472.     {
  473.         if (!$this->projets->contains($projet)) {
  474.             $this->projets->add($projet);
  475.             $projet->setGestionnaire($this);
  476.         }
  477.         return $this;
  478.     }
  479.     public function removeProjet(Projet $projet): self
  480.     {
  481.         if ($this->projets->removeElement($projet)) {
  482.             // set the owning side to null (unless already changed)
  483.             if ($projet->getGestionnaire() === $this) {
  484.                 $projet->setGestionnaire(null);
  485.             }
  486.         }
  487.         return $this;
  488.     }
  489.     /**
  490.      * @return Collection<int, ProjetMembre>
  491.      */
  492.     public function getProjetMembres(): Collection
  493.     {
  494.         return $this->projetMembres;
  495.     }
  496.     public function addProjetMembre(ProjetMembre $projetMembre): self
  497.     {
  498.         if (!$this->projetMembres->contains($projetMembre)) {
  499.             $this->projetMembres->add($projetMembre);
  500.             $projetMembre->setUser($this);
  501.         }
  502.         return $this;
  503.     }
  504.     public function removeProjetMembre(ProjetMembre $projetMembre): self
  505.     {
  506.         if ($this->projetMembres->removeElement($projetMembre)) {
  507.             // set the owning side to null (unless already changed)
  508.             if ($projetMembre->getUser() === $this) {
  509.                 $projetMembre->setUser(null);
  510.             }
  511.         }
  512.         return $this;
  513.     }
  514.     /**
  515.      * @return Collection<int, TaskAssign>
  516.      */
  517.     public function getTaskAssigns(): Collection
  518.     {
  519.         return $this->taskAssigns;
  520.     }
  521.     public function addTaskAssign(TaskAssign $taskAssign): self
  522.     {
  523.         if (!$this->taskAssigns->contains($taskAssign)) {
  524.             $this->taskAssigns->add($taskAssign);
  525.             $taskAssign->setUser($this);
  526.         }
  527.         return $this;
  528.     }
  529.     public function removeTaskAssign(TaskAssign $taskAssign): self
  530.     {
  531.         if ($this->taskAssigns->removeElement($taskAssign)) {
  532.             // set the owning side to null (unless already changed)
  533.             if ($taskAssign->getUser() === $this) {
  534.                 $taskAssign->setUser(null);
  535.             }
  536.         }
  537.         return $this;
  538.     }
  539.     /**
  540.      * @return Collection<int, Comment>
  541.      */
  542.     public function getComments(): Collection
  543.     {
  544.         return $this->comments;
  545.     }
  546.     public function addComment(Comment $comment): static
  547.     {
  548.         if (!$this->comments->contains($comment)) {
  549.             $this->comments->add($comment);
  550.             $comment->setAuthor($this);
  551.         }
  552.         return $this;
  553.     }
  554.     public function removeComment(Comment $comment): static
  555.     {
  556.         if ($this->comments->removeElement($comment)) {
  557.             // set the owning side to null (unless already changed)
  558.             if ($comment->getAuthor() === $this) {
  559.                 $comment->setAuthor(null);
  560.             }
  561.         }
  562.         return $this;
  563.     }
  564.     /**
  565.      * @return Collection<int, Bailleur>
  566.      */
  567.     public function getBailleurs(): Collection
  568.     {
  569.         return $this->bailleurs;
  570.     }
  571.     public function addBailleur(Bailleur $bailleur): static
  572.     {
  573.         if (!$this->bailleurs->contains($bailleur)) {
  574.             $this->bailleurs->add($bailleur);
  575.             $bailleur->setCreatedBy($this);
  576.         }
  577.         return $this;
  578.     }
  579.     public function removeBailleur(Bailleur $bailleur): static
  580.     {
  581.         if ($this->bailleurs->removeElement($bailleur)) {
  582.             // set the owning side to null (unless already changed)
  583.             if ($bailleur->getCreatedBy() === $this) {
  584.                 $bailleur->setCreatedBy(null);
  585.             }
  586.         }
  587.         return $this;
  588.     }
  589.     /**
  590.      * @return Collection<int, CategorieProjet>
  591.      */
  592.     public function getCategorieProjets(): Collection
  593.     {
  594.         return $this->categorieProjets;
  595.     }
  596.     public function addCategorieProjet(CategorieProjet $categorieProjet): static
  597.     {
  598.         if (!$this->categorieProjets->contains($categorieProjet)) {
  599.             $this->categorieProjets->add($categorieProjet);
  600.             $categorieProjet->setCreatedBy($this);
  601.         }
  602.         return $this;
  603.     }
  604.     public function removeCategorieProjet(CategorieProjet $categorieProjet): static
  605.     {
  606.         if ($this->categorieProjets->removeElement($categorieProjet)) {
  607.             // set the owning side to null (unless already changed)
  608.             if ($categorieProjet->getCreatedBy() === $this) {
  609.                 $categorieProjet->setCreatedBy(null);
  610.             }
  611.         }
  612.         return $this;
  613.     }
  614.     /**
  615.      * @return Collection<int, ModeFinance>
  616.      */
  617.     public function getModeFinances(): Collection
  618.     {
  619.         return $this->modeFinances;
  620.     }
  621.     public function addModeFinance(ModeFinance $modeFinance): static
  622.     {
  623.         if (!$this->modeFinances->contains($modeFinance)) {
  624.             $this->modeFinances->add($modeFinance);
  625.             $modeFinance->setCreatedBy($this);
  626.         }
  627.         return $this;
  628.     }
  629.     public function removeModeFinance(ModeFinance $modeFinance): static
  630.     {
  631.         if ($this->modeFinances->removeElement($modeFinance)) {
  632.             // set the owning side to null (unless already changed)
  633.             if ($modeFinance->getCreatedBy() === $this) {
  634.                 $modeFinance->setCreatedBy(null);
  635.             }
  636.         }
  637.         return $this;
  638.     }
  639.     /**
  640.      * @return Collection<int, Priority>
  641.      */
  642.     public function getPriorities(): Collection
  643.     {
  644.         return $this->priorities;
  645.     }
  646.     public function addPriority(Priority $priority): static
  647.     {
  648.         if (!$this->priorities->contains($priority)) {
  649.             $this->priorities->add($priority);
  650.             $priority->setCreatedBy($this);
  651.         }
  652.         return $this;
  653.     }
  654.     public function removePriority(Priority $priority): static
  655.     {
  656.         if ($this->priorities->removeElement($priority)) {
  657.             // set the owning side to null (unless already changed)
  658.             if ($priority->getCreatedBy() === $this) {
  659.                 $priority->setCreatedBy(null);
  660.             }
  661.         }
  662.         return $this;
  663.     }
  664.     /**
  665.      * @return Collection<int, Structure>
  666.      */
  667.     public function getStructures(): Collection
  668.     {
  669.         return $this->structures;
  670.     }
  671.     public function addStructure(Structure $structure): static
  672.     {
  673.         if (!$this->structures->contains($structure)) {
  674.             $this->structures->add($structure);
  675.             $structure->setCreatedBy($this);
  676.         }
  677.         return $this;
  678.     }
  679.     public function removeStructure(Structure $structure): static
  680.     {
  681.         if ($this->structures->removeElement($structure)) {
  682.             // set the owning side to null (unless already changed)
  683.             if ($structure->getCreatedBy() === $this) {
  684.                 $structure->setCreatedBy(null);
  685.             }
  686.         }
  687.         return $this;
  688.     }
  689.     /**
  690.      * @return Collection<int, RateOfProgress>
  691.      */
  692.     public function getRateOfProgress(): Collection
  693.     {
  694.         return $this->rateOfProgress;
  695.     }
  696.     public function addRateOfProgress(RateOfProgress $rateOfProgress): static
  697.     {
  698.         if (!$this->rateOfProgress->contains($rateOfProgress)) {
  699.             $this->rateOfProgress->add($rateOfProgress);
  700.             $rateOfProgress->setAuthor($this);
  701.         }
  702.         return $this;
  703.     }
  704.     public function removeRateOfProgress(RateOfProgress $rateOfProgress): static
  705.     {
  706.         if ($this->rateOfProgress->removeElement($rateOfProgress)) {
  707.             // set the owning side to null (unless already changed)
  708.             if ($rateOfProgress->getAuthor() === $this) {
  709.                 $rateOfProgress->setAuthor(null);
  710.             }
  711.         }
  712.         return $this;
  713.     }
  714.     /**
  715.      * @return Collection<int, RejectEvaluation>
  716.      */
  717.     public function getRejectEvaluations(): Collection
  718.     {
  719.         return $this->rejectEvaluations;
  720.     }
  721.     public function addRejectEvaluation(RejectEvaluation $rejectEvaluation): static
  722.     {
  723.         if (!$this->rejectEvaluations->contains($rejectEvaluation)) {
  724.             $this->rejectEvaluations->add($rejectEvaluation);
  725.             $rejectEvaluation->setAuthor($this);
  726.         }
  727.         return $this;
  728.     }
  729.     public function removeRejectEvaluation(RejectEvaluation $rejectEvaluation): static
  730.     {
  731.         if ($this->rejectEvaluations->removeElement($rejectEvaluation)) {
  732.             // set the owning side to null (unless already changed)
  733.             if ($rejectEvaluation->getAuthor() === $this) {
  734.                 $rejectEvaluation->setAuthor(null);
  735.             }
  736.         }
  737.         return $this;
  738.     }
  739.     /**
  740.      * @return Collection<int, Document>
  741.      */
  742.     public function getDocuments(): Collection
  743.     {
  744.         return $this->documents;
  745.     }
  746.     public function addDocument(Document $document): static
  747.     {
  748.         if (!$this->documents->contains($document)) {
  749.             $this->documents->add($document);
  750.             $document->setAuthor($this);
  751.         }
  752.         return $this;
  753.     }
  754.     public function removeDocument(Document $document): static
  755.     {
  756.         if ($this->documents->removeElement($document)) {
  757.             // set the owning side to null (unless already changed)
  758.             if ($document->getAuthor() === $this) {
  759.                 $document->setAuthor(null);
  760.             }
  761.         }
  762.         return $this;
  763.     }
  764.     /**
  765.      * @return Collection<int, Pao>
  766.      */
  767.     public function getPaos(): Collection
  768.     {
  769.         return $this->paos;
  770.     }
  771.     public function addPao(Pao $pao): static
  772.     {
  773.         if (!$this->paos->contains($pao)) {
  774.             $this->paos->add($pao);
  775.             $pao->setCreatedBy($this);
  776.         }
  777.         return $this;
  778.     }
  779.     public function removePao(Pao $pao): static
  780.     {
  781.         if ($this->paos->removeElement($pao)) {
  782.             // set the owning side to null (unless already changed)
  783.             if ($pao->getCreatedBy() === $this) {
  784.                 $pao->setCreatedBy(null);
  785.             }
  786.         }
  787.         return $this;
  788.     }
  789.     /**
  790.      * @return Collection<int, Objectif>
  791.      */
  792.     public function getObjectifs(): Collection
  793.     {
  794.         return $this->objectifs;
  795.     }
  796.     public function addObjectif(Objectif $objectif): static
  797.     {
  798.         if (!$this->objectifs->contains($objectif)) {
  799.             $this->objectifs->add($objectif);
  800.             $objectif->setCreatedBy($this);
  801.         }
  802.         return $this;
  803.     }
  804.     public function removeObjectif(Objectif $objectif): static
  805.     {
  806.         if ($this->objectifs->removeElement($objectif)) {
  807.             // set the owning side to null (unless already changed)
  808.             if ($objectif->getCreatedBy() === $this) {
  809.                 $objectif->setCreatedBy(null);
  810.             }
  811.         }
  812.         return $this;
  813.     }
  814.     /**
  815.      * @return Collection<int, Activity>
  816.      */
  817.     public function getActivities(): Collection
  818.     {
  819.         return $this->activities;
  820.     }
  821.     public function addActivity(Activity $activity): static
  822.     {
  823.         if (!$this->activities->contains($activity)) {
  824.             $this->activities->add($activity);
  825.             $activity->setCreatedBy($this);
  826.         }
  827.         return $this;
  828.     }
  829.     public function removeActivity(Activity $activity): static
  830.     {
  831.         if ($this->activities->removeElement($activity)) {
  832.             // set the owning side to null (unless already changed)
  833.             if ($activity->getCreatedBy() === $this) {
  834.                 $activity->setCreatedBy(null);
  835.             }
  836.         }
  837.         return $this;
  838.     }
  839.     /**
  840.      * @return Collection<int, Evaluation>
  841.      */
  842.     public function getEvaluations(): Collection
  843.     {
  844.         return $this->evaluations;
  845.     }
  846.     public function addEvaluation(Evaluation $evaluation): static
  847.     {
  848.         if (!$this->evaluations->contains($evaluation)) {
  849.             $this->evaluations->add($evaluation);
  850.             $evaluation->setCreatedBy($this);
  851.         }
  852.         return $this;
  853.     }
  854.     public function removeEvaluation(Evaluation $evaluation): static
  855.     {
  856.         if ($this->evaluations->removeElement($evaluation)) {
  857.             // set the owning side to null (unless already changed)
  858.             if ($evaluation->getCreatedBy() === $this) {
  859.                 $evaluation->setCreatedBy(null);
  860.             }
  861.         }
  862.         return $this;
  863.     }
  864.     /**
  865.      * @return Collection<int, EvaluationCritere>
  866.      */
  867.     public function getEvaluationCriteres(): Collection
  868.     {
  869.         return $this->evaluationCriteres;
  870.     }
  871.     public function addEvaluationCritere(EvaluationCritere $evaluationCritere): static
  872.     {
  873.         if (!$this->evaluationCriteres->contains($evaluationCritere)) {
  874.             $this->evaluationCriteres->add($evaluationCritere);
  875.             $evaluationCritere->setCreatedBy($this);
  876.         }
  877.         return $this;
  878.     }
  879.     public function removeEvaluationCritere(EvaluationCritere $evaluationCritere): static
  880.     {
  881.         if ($this->evaluationCriteres->removeElement($evaluationCritere)) {
  882.             // set the owning side to null (unless already changed)
  883.             if ($evaluationCritere->getCreatedBy() === $this) {
  884.                 $evaluationCritere->setCreatedBy(null);
  885.             }
  886.         }
  887.         return $this;
  888.     }
  889.      // Méthode pour ajouter une réunion
  890.      public function addMeeting(Meeting $meeting): void
  891.      {
  892.          if (!$this->meetings->contains($meeting)) {
  893.              $this->meetings[] = $meeting;
  894.              $meeting->setUser($this); // Associer l'utilisateur à la réunion
  895.          }
  896.      }
  897.       // Méthode pour supprimer une réunion
  898.     public function removeMeeting(Meeting $meeting): void
  899.     {
  900.         if ($this->meetings->contains($meeting)) {
  901.             $this->meetings->removeElement($meeting);
  902.             // Dissocier l'utilisateur de la réunion
  903.             if ($meeting->getUser() === $this) {
  904.                 $meeting->setUser(null);
  905.             }
  906.         }
  907.     }
  908. }