Deprecated: Constant E_STRICT is deprecated in /var/www/PixelForce/vendor/symfony/error-handler/ErrorHandler.php on line 58

Deprecated: Constant E_STRICT is deprecated in /var/www/PixelForce/vendor/symfony/error-handler/ErrorHandler.php on line 76
Symfony Profiler

src/Entity/User.php line 1519

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserRepository;
  4. use App\Services\StripeService;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Exception;
  10. use JsonSerializable;
  11. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  12. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  13. use Symfony\Component\Security\Core\User\UserInterface;
  14. use Symfony\Component\Serializer\Annotation\Groups;
  15. use Symfony\Component\Serializer\Annotation\Ignore;
  16. use Symfony\Component\Validator\Constraints as Assert;
  17. /**
  18.  * @ORM\Entity(repositoryClass=UserRepository::class)
  19.  * @ORM\Table(name="`user`")
  20.  * @UniqueEntity("username", message="Nom d'utilisateur déjà utilisé")
  21.  * @UniqueEntity("email", message="Adresse email déjà utilisé")
  22.  */
  23. class User implements UserInterfacePasswordAuthenticatedUserInterfaceJsonSerializable
  24. {
  25.     const ROLE_AGENT 'ROLE_AGENT';
  26.     const ROLE_MADA 'ROLE_MADA';
  27.     const ROLE_COACH 'ROLE_COACH';
  28.     const ROLE_AMBASSADEUR 'ROLE_AMBASSADEUR';
  29.     const ROLE_ADMINISTRATEUR 'ROLE_ADMINISTRATEUR';
  30.     const ROLE_CLIENT 'ROLE_CLIENT';
  31.     const ROLE_DOCUMENT_OWNER 'ROLE_DOCUMENT_OWNER';
  32.     const ROLES = [
  33.         self::ROLE_AGENT => self::ROLE_AGENT,
  34.         self::ROLE_MADA => self::ROLE_MADA,
  35.         self::ROLE_COACH => self::ROLE_AGENT,
  36.         self::ROLE_ADMINISTRATEUR => self::ROLE_ADMINISTRATEUR,
  37.         self::ROLE_CLIENT => self::ROLE_CLIENT,
  38.         self::ROLE_DOCUMENT_OWNER => self::ROLE_DOCUMENT_OWNER,
  39.         self::ROLE_AMBASSADEUR => self::ROLE_AMBASSADEUR,
  40.     ];
  41.     const INACTIVE_STATE = -;
  42.     /**
  43.      *  Clés disponibles :
  44.      *  - UNPAID : l'user n'a pas encore procédé au paiement
  45.      *  - TRIAL : Statut éssaie (14 jours) 
  46.      *  - ACTIVE : Statut après 2ème paiement (Qui n'est plus TRIAL)
  47.      * 
  48.      *  - EXPIRED : "Qui nous sert seulement de teste ! " - Statut lorsque le compte a dépassé un tel délai (14jrs ou autres...)
  49.      */
  50.     const ACCOUNT_STATUS = [
  51.         'UNPAID' => 'Impaye',
  52.         'TRIAL' => 'Essai',
  53.         'ACTIVE' => 'Actif',
  54.         'EXPIRED' => 'Expiré'
  55.     ];
  56.     const ACCOUNT_PRICE_TRIAL 1.0;
  57.     const ACCOUNT_PRICE_INTEGRAL 20.0;
  58.     const ACCOUNT_PRICE_ONE_SECTOR 97.0;
  59.     const ACCOUNT_PRICE_MANY_SECTOR 297.0;
  60.     /**
  61.      *  Clés disponibles :
  62.      *  - TRIAL 
  63.      *  - INTEGRAL
  64.      *  - ONE_SECTOR
  65.      *  - MANY_SECTOR
  66.      */
  67.     const ACCOUNT_PRICE = [
  68.         'TRIAL' => self::ACCOUNT_PRICE_TRIAL,
  69.         'INTEGRAL' => self::ACCOUNT_PRICE_INTEGRAL,
  70.         'ONE_SECTOR' => self::ACCOUNT_PRICE_ONE_SECTOR,
  71.         'MANY_SECTOR' => self::ACCOUNT_PRICE_MANY_SECTOR
  72.     ];
  73.     const EXPIRY_DATE 14;
  74.     /**
  75.      * @ORM\Id
  76.      * @ORM\GeneratedValue
  77.      * @ORM\Column(type="integer")
  78.      * @Groups({"chat"})
  79.      */
  80.     private $id;
  81.     /**
  82.      * @ORM\Column(type="string", length=180, unique=true)
  83.      * @Groups({"chat"})
  84.      */
  85.     private $email;
  86.     /**
  87.      * @ORM\Column(type="string", length=255, nullable=true)
  88.      */
  89.     private $username;
  90.     /**
  91.      * @ORM\ManyToOne(targetEntity=User::class)
  92.      * @ORM\JoinColumn(name="parrain_id", referencedColumnName="id", nullable=true)
  93.      */
  94.     private $parrain;
  95.     /**
  96.      * @ORM\OneToMany(targetEntity=User::class, mappedBy="parrain")
  97.      */
  98.     private $fils;
  99.     /**
  100.      * @ORM\Column(type="json")
  101.      */
  102.     private $roles = [];
  103.     /**
  104.      * @var string The hashed password
  105.      * @ORM\Column(type="string")
  106.      */
  107.     private $password;
  108.     /**
  109.      * @ORM\Column(type="string", length=255, nullable=true)
  110.      * @Groups({"chat"})
  111.      */
  112.     private $nom;
  113.     /**
  114.      * @ORM\Column(type="string", length=255, nullable=true)
  115.      * @Groups({"chat"})
  116.      */
  117.     private $prenom;
  118.     /**
  119.      * @ORM\Column(type="datetime", nullable=true)
  120.      */
  121.     private $dateNaissance;
  122.     /**
  123.      * @ORM\Column(type="string", length=255, nullable=true)
  124.      */
  125.     private $adresse;
  126.     /**
  127.      * @ORM\Column(type="string", length=255, nullable=true)
  128.      */
  129.     private $numeroSecurite;
  130.     /**
  131.      * @ORM\Column(type="string", length=255, nullable=true)
  132.      */
  133.     private $rib;
  134.     /**
  135.      * @ORM\Column(type="string", length=255, nullable=true)
  136.      */
  137.     private $photo;
  138.     /**
  139.      * @ORM\Column(type="integer", nullable=true)
  140.      */
  141.     private $sixDigitCode;
  142.     /**
  143.      * @ORM\Column(type="string", length=255, nullable=true)
  144.      */
  145.     private $forgottenPassToken;
  146.     /**
  147.      * @ORM\OneToMany(targetEntity=CoachAgent::class, mappedBy="coach")
  148.      */
  149.     private $coachAgents;
  150.     /**
  151.      * @ORM\Column(type="integer", nullable=true)
  152.      */
  153.     private $active;
  154.     /**
  155.      * @ORM\OneToMany(targetEntity=LiveChatVideo::class, mappedBy="userA")
  156.      */
  157.     private $liveChatVideosFromUserA;
  158.     /**
  159.      * @ORM\OneToMany(targetEntity=LiveChatVideo::class, mappedBy="userB")
  160.      */
  161.     private $liveChatVideosFromUserB;
  162.     /**
  163.      * @ORM\OneToMany(targetEntity=VideoFormation::class, mappedBy="user")
  164.      */
  165.     private $videoFormations;
  166.     /**
  167.      * @ORM\OneToMany(targetEntity=Commentaire::class, mappedBy="user")
  168.      */
  169.     private $commentaires;
  170.     /**
  171.      * @ORM\OneToMany(targetEntity=Message::class, mappedBy="user")
  172.      */
  173.     private $messages;
  174.     /**
  175.      * @ORM\ManyToMany(targetEntity=CanalMessage::class, mappedBy="users")
  176.      */
  177.     private $canalMessages;
  178.     /**
  179.      * @ORM\Column(type="string", length=255, nullable=true)
  180.      */
  181.     private $ApiToken;
  182.     /**
  183.      * @Groups({"chat"})
  184.      */
  185.     private $chatCode;
  186.     /**
  187.      * @ORM\Column(type="string", length=50, nullable=true)
  188.      */
  189.     private $telephone;
  190.     /**
  191.      * @ORM\Column(type="datetime", nullable=true)
  192.      */
  193.     private $created_at;
  194.     /**
  195.      * @ORM\OneToMany(targetEntity=Contact::class, mappedBy="agent", orphanRemoval=true)
  196.      */
  197.     private $contact;
  198.     /**
  199.      * @ORM\ManyToOne(targetEntity=Contact::class, inversedBy="client")
  200.      */
  201.     private $contact_client;
  202.     /**
  203.      * @ORM\Column(type="string", length=255, nullable=true)
  204.      */
  205.     private $codePostal;
  206.     /**
  207.      * @ORM\OneToMany(targetEntity=Formation::class, mappedBy="coach")
  208.      */
  209.     private $formations;
  210.     /**
  211.      * @ORM\OneToMany(targetEntity=FormationAgent::class, mappedBy="agent")
  212.      */
  213.     private $formationAgents;
  214.     /**
  215.      * @ORM\OneToMany(targetEntity=CoachSecteur::class, mappedBy="coach")
  216.      */
  217.     private $coachSecteurs;
  218.     /**
  219.      * @ORM\OneToMany(targetEntity=AgentSecteur::class, mappedBy="agent", fetch="EAGER", cascade={"persist"})
  220.      */
  221.     private $agentSecteurs;
  222.     /**
  223.      * @ORM\Column(type="string", length=255, nullable=true)
  224.      */
  225.     private $lienCalendly;
  226.     /**
  227.      * @ORM\OneToMany(targetEntity="CalendarEvent", mappedBy="user")
  228.      */
  229.     private $calendarEvents;
  230.     /**
  231.      * @ORM\OneToMany(targetEntity=CategorieFormationAgent::class, mappedBy="agent", orphanRemoval=true)
  232.      */
  233.     private $categorieFormationAgents;
  234.     /**
  235.      * @ORM\OneToMany(targetEntity="Meeting", mappedBy="user")
  236.      */
  237.     private $meetings;
  238.     /**
  239.      * @ORM\OneToMany(targetEntity="Meeting", mappedBy="userToMeet")
  240.      */
  241.     private $meetingGuests;
  242.     /**
  243.      * @ORM\ManyToOne(targetEntity=User::class)
  244.      */
  245.     private $clientAgent;
  246.     private $plainPassword;
  247.     /**
  248.      * @ORM\Column(type="array", nullable=true)
  249.      */
  250.     private $stripe_data = [];
  251.     /**
  252.      * @ORM\Column(type="string", length=50, nullable=true)
  253.      */
  254.     private $accountStatus;
  255.     /**
  256.      * @ORM\Column(type="datetime", nullable=true)
  257.      */
  258.     private $accountStartDate;
  259.     /**
  260.      * @ORM\OneToMany(targetEntity=SubscriptionPlanAgentAccount::class, mappedBy="user")
  261.      */
  262.     private $subscriptionPlanAgentAccounts;
  263.     /**
  264.      * @ORM\Column(type="string", length=50, nullable=true)
  265.      */
  266.     private $stripeCustomerId;
  267.     /**
  268.      * @ORM\OneToMany(targetEntity=OrderDigital::class, mappedBy="agent")
  269.      */
  270.     private $orderDigitals;
  271.     /**
  272.      * @ORM\Column(type="string", length=255, nullable=true)
  273.      */
  274.     private $numero_rue;
  275.     /**
  276.      * @ORM\Column(type="string", length=255, nullable=true)
  277.      */
  278.     private $ville;
  279.     /*
  280.      * @ORM\OneToMany(targetEntity=DevisCompany::class, mappedBy="agent")
  281.      */
  282.     private $devisCompanies;
  283.     /**
  284.      * @ORM\Column(type="string", length=255, nullable=true)
  285.      */
  286.     private $ambassadorUsername;
  287.     private $accessibleFonctionnalites = [];
  288.     /**
  289.      * @ORM\Column(type="integer", nullable=true)
  290.      */
  291.     private $position;
  292.     public function __construct()
  293.     {
  294.         $this->coachAgents = new ArrayCollection();
  295.         $this->liveChatVideosFromUserA = new ArrayCollection();
  296.         $this->liveChatVideosFromUserB = new ArrayCollection();
  297.         $this->videoFormations = new ArrayCollection();
  298.         $this->commentaires = new ArrayCollection();
  299.         $this->messages = new ArrayCollection();
  300.         $this->canalMessages = new ArrayCollection();
  301.         $this->created_at = new \DateTime();
  302.         $this->contact = new ArrayCollection();
  303.         $this->formations = new ArrayCollection();
  304.         $this->formationAgents = new ArrayCollection();
  305.         $this->coachSecteurs = new ArrayCollection();
  306.         $this->agentSecteurs = new ArrayCollection();
  307.         $this->calendarEvents = new ArrayCollection();
  308.         $this->categorieFormationAgents = new ArrayCollection();
  309.         $this->meetings = new ArrayCollection();
  310.         $this->meetingGuests = new ArrayCollection();
  311.         $this->subscriptionPlanAgentAccounts = new ArrayCollection();
  312.         $this->orderDigitals = new ArrayCollection();
  313.         $this->devisCompanies = new ArrayCollection();
  314.         $this->fils = new ArrayCollection();
  315.     }
  316.     public function getId(): ?int
  317.     {
  318.         return $this->id;
  319.     }
  320.     public function getAccessibleFonctionnalites($secteurId): ?array
  321.     {
  322.         $key ''$secteurId;
  323.         return isset($this->accessibleFonctionnalites[$key]) && $this->accessibleFonctionnalites[$key] ? $this->accessibleFonctionnalites[$key] : null;
  324.     }
  325.     public function setAccessibleFonctionnalites($secteurId, array $accessibleFonctionnalitesSecteur): self
  326.     {
  327.         $key ''$secteurId;
  328.         $this->accessibleFonctionnalites[$key] = $accessibleFonctionnalitesSecteur;
  329.         return $this;
  330.     }
  331.     
  332.     public function getPosition(): ?int
  333.     {
  334.         return $this->position;
  335.     }
  336.     public function setPosition(int $position): self
  337.     {
  338.         $this->position $position;
  339.         return $this;
  340.     }
  341.     public function getEmail(): ?string
  342.     {
  343.         return $this->email;
  344.     }
  345.     public function setEmail(string $email): self
  346.     {
  347.         $this->email $email;
  348.         return $this;
  349.     }
  350.     public function getAmbassadorUsername(): ?string
  351.     {
  352.         return $this->ambassadorUsername;
  353.     }
  354.     public function setAmbassadorUsername(string $ambassadorUsername): self
  355.     {
  356.         $this->ambassadorUsername $ambassadorUsername;
  357.         return $this;
  358.     }
  359.     /**
  360.      * A visual identifier that represents this user.
  361.      *
  362.      * @see UserInterface
  363.      */
  364.     public function getUserIdentifier(): string
  365.     {
  366.         return (string) $this->email;
  367.     }
  368.     /**
  369.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  370.      */
  371.     public function getUsername(): string
  372.     {
  373.         return (string) $this->username;
  374.     }
  375.     public function setUsername(?string $username): self
  376.     {
  377.         $this->username $username;
  378.         return $this;
  379.     }
  380.     /**
  381.      * @see UserInterface
  382.      */
  383.     public function getRoles(): array
  384.     {
  385.         $roles $this->roles;
  386.         // guarantee every user at least has ROLE_USER
  387.         //        $roles[] = self::ROLE_AGENT;
  388.         $roles[] = 'ROLE_USER';
  389.         return array_unique($roles);
  390.     }
  391.     public function setRoles(array $roles): self
  392.     {
  393.         $this->roles $roles;
  394.         return $this;
  395.     }
  396.     public function getStringRole()
  397.     {
  398.         switch ($this->roles[0]) {
  399.             case self::ROLE_AGENT:
  400.                 return 'Agent';
  401.                 break;
  402.             case self::ROLE_COACH:
  403.                 return 'Coach';
  404.                 break;
  405.             case self::ROLE_ADMINISTRATEUR:
  406.                 return 'Administrateur';
  407.                 break;
  408.             case self::ROLE_CLIENT:
  409.                 return 'Client';
  410.                 break;
  411.             case self::ROLE_DOCUMENT_OWNER:
  412.                 return 'Propriétaire de document';
  413.                 break;
  414.         }
  415.     }
  416.     /**
  417.      * @see PasswordAuthenticatedUserInterface
  418.      */
  419.     public function getPassword(): string
  420.     {
  421.         return $this->password;
  422.     }
  423.     public function setPassword(string $password): self
  424.     {
  425.         $this->password $password;
  426.         return $this;
  427.     }
  428.     /**
  429.      * Returning a salt is only needed, if you are not using a modern
  430.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  431.      *
  432.      * @see UserInterface
  433.      */
  434.     public function getSalt(): ?string
  435.     {
  436.         return null;
  437.     }
  438.     /**
  439.      * @see UserInterface
  440.      */
  441.     public function eraseCredentials()
  442.     {
  443.         // If you store any temporary, sensitive data on the user, clear it here
  444.         // $this->plainPassword = null;
  445.     }
  446.     public function getNom(): ?string
  447.     {
  448.         return $this->nom;
  449.     }
  450.     public function setNom(?string $nom): self
  451.     {
  452.         $this->nom $nom;
  453.         return $this;
  454.     }
  455.     public function getPrenom(): ?string
  456.     {
  457.         return $this->prenom;
  458.     }
  459.     public function setPrenom(?string $prenom): self
  460.     {
  461.         $this->prenom $prenom;
  462.         return $this;
  463.     }
  464.     public function getDateNaissance(): ?\DateTimeInterface
  465.     {
  466.         return $this->dateNaissance;
  467.     }
  468.     public function setDateNaissance(?\DateTimeInterface $dateNaissance): self
  469.     {
  470.         $this->dateNaissance $dateNaissance;
  471.         return $this;
  472.     }
  473.     public function getAdresse(): ?string
  474.     {
  475.         return $this->adresse;
  476.     }
  477.     public function setAdresse(?string $adresse): self
  478.     {
  479.         $this->adresse $adresse;
  480.         return $this;
  481.     }
  482.     public function getNumeroSecurite(): ?string
  483.     {
  484.         return $this->numeroSecurite;
  485.     }
  486.     public function setNumeroSecurite(?string $numeroSecurite): self
  487.     {
  488.         $this->numeroSecurite $numeroSecurite;
  489.         return $this;
  490.     }
  491.     public function getRib(): ?string
  492.     {
  493.         return $this->rib;
  494.     }
  495.     public function setRib(?string $rib): self
  496.     {
  497.         $this->rib $rib;
  498.         return $this;
  499.     }
  500.     public function getPhoto(): ?string
  501.     {
  502.         return $this->photo;
  503.     }
  504.     public function setPhoto(?string $photo null$setNull false): self
  505.     {
  506.         $this->photo $photo $photo $this->photo;
  507.         if ($setNull) {
  508.             $this->photo null;
  509.         }
  510.         return $this;
  511.     }
  512.     public function getSixDigitCode(): ?int
  513.     {
  514.         return $this->sixDigitCode;
  515.     }
  516.     public function setSixDigitCode(?int $sixDigitCode): self
  517.     {
  518.         $this->sixDigitCode $sixDigitCode;
  519.         return $this;
  520.     }
  521.     public function getForgottenPassToken(): ?string
  522.     {
  523.         return $this->forgottenPassToken;
  524.     }
  525.     public function setForgottenPassToken(?string $forgottenPassToken): self
  526.     {
  527.         $this->forgottenPassToken $forgottenPassToken;
  528.         return $this;
  529.     }
  530.     public function validateSixDigitCode($sixDigitCode): bool
  531.     {
  532.         if ($this->sixDigitCode === (int) $sixDigitCode) {
  533.             return true;
  534.         }
  535.         return false;
  536.     }
  537.     public function validateForgottenPassToken($forgotten_pass)
  538.     {
  539.         if ($this->forgottenPassToken ===  $forgotten_pass) {
  540.             return true;
  541.         }
  542.         return false;
  543.     }
  544.     /**
  545.      * @return Collection<int, CoachAgent>
  546.      */
  547.     public function getCoachAgents(): Collection
  548.     {
  549.         return $this->coachAgents;
  550.     }
  551.     public function addCoachAgent(CoachAgent $coachAgent): self
  552.     {
  553.         if (!$this->coachAgents->contains($coachAgent)) {
  554.             $this->coachAgents[] = $coachAgent;
  555.             $coachAgent->setCoach($this);
  556.         }
  557.         return $this;
  558.     }
  559.     public function removeCoachAgent(CoachAgent $coachAgent): self
  560.     {
  561.         if ($this->coachAgents->removeElement($coachAgent)) {
  562.             // set the owning side to null (unless already changed)
  563.             if ($coachAgent->getCoach() === $this) {
  564.                 $coachAgent->setCoach(null);
  565.             }
  566.         }
  567.         return $this;
  568.     }
  569.     public function getActive(): ?int
  570.     {
  571.         return $this->active;
  572.     }
  573.     public function setActive(?int $active): self
  574.     {
  575.         $this->active $active;
  576.         return $this;
  577.     }
  578.     /**
  579.      * @return Collection<int, LiveChatVideo>
  580.      */
  581.     public function getLiveChatVideosFromA(): Collection
  582.     {
  583.         return $this->liveChatVideosFromUserA;
  584.     }
  585.     public function addLiveChatVideoFromA(LiveChatVideo $liveChatVideo): self
  586.     {
  587.         if (!$this->liveChatVideosFromUserA->contains($liveChatVideo)) {
  588.             $this->liveChatVideosFromUserA[] = $liveChatVideo;
  589.             $liveChatVideo->setUserA($this);
  590.         }
  591.         return $this;
  592.     }
  593.     public function removeLiveChatVideoFromA(LiveChatVideo $liveChatVideo): self
  594.     {
  595.         if ($this->liveChatVideosFromUserA->removeElement($liveChatVideo)) {
  596.             // set the owning side to null (unless already changed)
  597.             if ($liveChatVideo->getUserA() === $this) {
  598.                 $liveChatVideo->setUserA(null);
  599.             }
  600.         }
  601.         return $this;
  602.     }
  603.     /**
  604.      * @return Collection<int, LiveChatVideo>
  605.      */
  606.     public function getLiveChatVideosFromB(): Collection
  607.     {
  608.         return $this->liveChatVideosFromUserB;
  609.     }
  610.     public function addLiveChatVideoFromB(LiveChatVideo $liveChatVideo): self
  611.     {
  612.         if (!$this->liveChatVideosFromUserB->contains($liveChatVideo)) {
  613.             $this->liveChatVideosFromUserB[] = $liveChatVideo;
  614.             $liveChatVideo->setUserB($this);
  615.         }
  616.         return $this;
  617.     }
  618.     public function removeLiveChatVideoFromB(LiveChatVideo $liveChatVideo): self
  619.     {
  620.         if ($this->liveChatVideosFromUserB->removeElement($liveChatVideo)) {
  621.             // set the owning side to null (unless already changed)
  622.             if ($liveChatVideo->getUserB() === $this) {
  623.                 $liveChatVideo->setUserB(null);
  624.             }
  625.         }
  626.         return $this;
  627.     }
  628.     /**
  629.      * @return Collection<int, VideoFormation>
  630.      */
  631.     public function getVideoFormations(): Collection
  632.     {
  633.         return $this->videoFormations;
  634.     }
  635.     public function addVideoFormation(VideoFormation $videoFormation): self
  636.     {
  637.         if (!$this->videoFormations->contains($videoFormation)) {
  638.             $this->videoFormations[] = $videoFormation;
  639.             $videoFormation->setUser($this);
  640.         }
  641.         return $this;
  642.     }
  643.     public function removeVideoFormation(VideoFormation $videoFormation): self
  644.     {
  645.         if ($this->videoFormations->removeElement($videoFormation)) {
  646.             // set the owning side to null (unless already changed)
  647.             if ($videoFormation->getUser() === $this) {
  648.                 $videoFormation->setUser(null);
  649.             }
  650.         }
  651.         return $this;
  652.     }
  653.     /**
  654.      * @return Collection<int, Commentaire>
  655.      */
  656.     public function getCommentaires(): Collection
  657.     {
  658.         return $this->commentaires;
  659.     }
  660.     public function addCommentaire(Commentaire $commentaire): self
  661.     {
  662.         if (!$this->commentaires->contains($commentaire)) {
  663.             $this->commentaires[] = $commentaire;
  664.             $commentaire->setUser($this);
  665.         }
  666.         return $this;
  667.     }
  668.     public function removeCommentaire(Commentaire $commentaire): self
  669.     {
  670.         if ($this->commentaires->removeElement($commentaire)) {
  671.             // set the owning side to null (unless already changed)
  672.             if ($commentaire->getUser() === $this) {
  673.                 $commentaire->setUser(null);
  674.             }
  675.         }
  676.         return $this;
  677.     }
  678.     /**
  679.      * @return Collection<int, Message>
  680.      */
  681.     public function getMessages(): Collection
  682.     {
  683.         return $this->messages;
  684.     }
  685.     public function addMessage(Message $message): self
  686.     {
  687.         if (!$this->messages->contains($message)) {
  688.             $this->messages[] = $message;
  689.             $message->setUser($this);
  690.         }
  691.         return $this;
  692.     }
  693.     public function removeMessage(Message $message): self
  694.     {
  695.         if ($this->messages->removeElement($message)) {
  696.             // set the owning side to null (unless already changed)
  697.             if ($message->getUser() === $this) {
  698.                 $message->setUser(null);
  699.             }
  700.         }
  701.         return $this;
  702.     }
  703.     public function clearMessages()
  704.     {
  705.         $this->messages->clear();
  706.     }
  707.     /**
  708.      * @return Collection<int, CanalMessage>
  709.      */
  710.     public function getCanalMessages(): Collection
  711.     {
  712.         return $this->canalMessages;
  713.     }
  714.     public function addCanalMessage(CanalMessage $canalMessage): self
  715.     {
  716.         if (!$this->canalMessages->contains($canalMessage)) {
  717.             $this->canalMessages[] = $canalMessage;
  718.             $canalMessage->addUser($this);
  719.         }
  720.         return $this;
  721.     }
  722.     public function removeCanalMessage(CanalMessage $canalMessage): self
  723.     {
  724.         if ($this->canalMessages->removeElement($canalMessage)) {
  725.             $canalMessage->removeUser($this);
  726.         }
  727.         return $this;
  728.     }
  729.     public function clearCanalMessages()
  730.     {
  731.         $this->canalMessages->clear();
  732.     }
  733.     public function getApiToken(): ?string
  734.     {
  735.         return $this->ApiToken;
  736.     }
  737.     public function setApiToken(?string $ApiToken): self
  738.     {
  739.         $this->ApiToken $ApiToken;
  740.         return $this;
  741.     }
  742.     /**
  743.      * @return mixed
  744.      */
  745.     public function getChatCode()
  746.     {
  747.         return $this->chatCode $this->chatCode $this->id;
  748.     }
  749.     /**
  750.      * @param mixed $chatCode
  751.      * @return User
  752.      */
  753.     public function setChatCode($chatCode)
  754.     {
  755.         $this->chatCode $chatCode;
  756.         return $this;
  757.     }
  758.     public function getTelephone(): ?string
  759.     {
  760.         return $this->telephone;
  761.     }
  762.     public function setTelephone(?string $telephone): self
  763.     {
  764.         $this->telephone $telephone;
  765.         return $this;
  766.     }
  767.     public function fullName()
  768.     {
  769.         return $this->nom ' ' $this->prenom;
  770.     }
  771.     public function getCreatedAt(): ?\DateTimeInterface
  772.     {
  773.         return $this->created_at;
  774.     }
  775.     public function setCreatedAt(\DateTimeInterface $created_at): self
  776.     {
  777.         $this->created_at $created_at;
  778.         return $this;
  779.     }
  780.     /**
  781.      * @return Collection<int, Contact>
  782.      */
  783.     public function getContact(): Collection
  784.     {
  785.         return $this->contact;
  786.     }
  787.     public function addContact(Contact $contact): self
  788.     {
  789.         if (!$this->contact->contains($contact)) {
  790.             $this->contact[] = $contact;
  791.             $contact->setAgent($this);
  792.         }
  793.         return $this;
  794.     }
  795.     public function removeContact(Contact $contact): self
  796.     {
  797.         if ($this->contact->removeElement($contact)) {
  798.             // set the owning side to null (unless already changed)
  799.             if ($contact->getAgent() === $this) {
  800.                 $contact->setAgent(null);
  801.             }
  802.         }
  803.         return $this;
  804.     }
  805.     public function getContactClient(): ?Contact
  806.     {
  807.         return $this->contact_client;
  808.     }
  809.     public function setContactClient(?Contact $contact_client): self
  810.     {
  811.         $this->contact_client $contact_client;
  812.         return $this;
  813.     }
  814.     public function removeAllAgentSecteur()
  815.     {
  816.         $this->agentSecteurs->clear();
  817.     }
  818.     public function getCodePostal(): ?string
  819.     {
  820.         return $this->codePostal;
  821.     }
  822.     public function setCodePostal(?string $codePostal): self
  823.     {
  824.         $this->codePostal $codePostal;
  825.         return $this;
  826.     }
  827.     /**
  828.      * @return Collection<int, Formation>
  829.      */
  830.     public function getFormations(): Collection
  831.     {
  832.         return $this->formations;
  833.     }
  834.     public function addFormation(Formation $formation): self
  835.     {
  836.         if (!$this->formations->contains($formation)) {
  837.             $this->formations[] = $formation;
  838.             $formation->setCoach($this);
  839.         }
  840.         return $this;
  841.     }
  842.     public function removeFormation(Formation $formation): self
  843.     {
  844.         if ($this->formations->removeElement($formation)) {
  845.             // set the owning side to null (unless already changed)
  846.             if ($formation->getCoach() === $this) {
  847.                 $formation->setCoach(null);
  848.             }
  849.         }
  850.         return $this;
  851.     }
  852.     /**
  853.      * @return Collection<int, FormationAgent>
  854.      */
  855.     public function getFormationAgents(): Collection
  856.     {
  857.         return $this->formationAgents;
  858.     }
  859.     public function addFormationAgent(FormationAgent $formationAgent): self
  860.     {
  861.         if (!$this->formationAgents->contains($formationAgent)) {
  862.             $this->formationAgents[] = $formationAgent;
  863.             $formationAgent->setAgent($this);
  864.         }
  865.         return $this;
  866.     }
  867.     public function removeFormationAgent(FormationAgent $formationAgent): self
  868.     {
  869.         if ($this->formationAgents->removeElement($formationAgent)) {
  870.             // set the owning side to null (unless already changed)
  871.             if ($formationAgent->getAgent() === $this) {
  872.                 $formationAgent->setAgent(null);
  873.             }
  874.         }
  875.         return $this;
  876.     }
  877.     // public function getFormationStatut(Formation $formation)
  878.     // {
  879.     //    $formationAgents =  $formation->getFormationAgents();
  880.     //    foreach($formationAgents->toArray() as $formationAgent) {
  881.     //        if($formationAgent->getAgent()->getId() === $this->getId()) {
  882.     //            return $formationAgent->getStatut();
  883.     //        }
  884.     //    }
  885.     //    return '';
  886.     // }
  887.     public function getFormationStatut(Formation $formation)
  888.     {
  889.         $formationAgents =  $formation->getFormationAgents();
  890.         foreach ($formationAgents->toArray() as $formationAgent) {
  891.             if ($formationAgent->getAgent()->getId() === $this->getId()) {
  892.                 return $formationAgent->getStatut();
  893.             }
  894.         }
  895.         return Formation::STATUT_DISPONIBLE;
  896.     }
  897.     /**
  898.      * Permet de renvoyer un string contenant les secteurs d'un agent en les cocaténant par une virgule
  899.      *
  900.      * @param array $secteurs
  901.      * @return string
  902.      */
  903.     public function allSecteursOfUser(array $agentSecteurs)
  904.     {
  905.         $mySecteurs = [];
  906.         /** @var AgentSecteur $secteur */
  907.         foreach ($agentSecteurs as $agentSecteur) {
  908.             $mySecteurs[] = $agentSecteur->getSecteur()->getNom();
  909.         }
  910.         $joinSecteur join(', '$mySecteurs);
  911.         return $joinSecteur;
  912.     }
  913.     public function pricePlanAccountBySecteurChoice(array $agentSecteurs)
  914.     {
  915.         $nbrSector count($agentSecteurs);
  916.         if ($nbrSector <= 1) {
  917.             $price self::ACCOUNT_PRICE_ONE_SECTOR;
  918.         } else {
  919.             $price self::ACCOUNT_PRICE_MANY_SECTOR;
  920.         }
  921.         return $price;
  922.     }
  923.     public function typePlanAccountBySecteurChoice(array $agentSecteurs)
  924.     {
  925.         $nbrSector count($agentSecteurs);
  926.         if ($nbrSector <= 1) {
  927.             $type StripeService::ACCOUNT_SUBSCRIPTION_TYPE['ONE_SECTOR'];
  928.         } else {
  929.             $type StripeService::ACCOUNT_SUBSCRIPTION_TYPE['MANY_SECTOR'];
  930.         }
  931.         return $type;
  932.     }
  933.     /**
  934.      * @return Collection<int, CoachSecteur>
  935.      */
  936.     public function getCoachSecteurs(): Collection
  937.     {
  938.         return $this->coachSecteurs;
  939.     }
  940.     public function addCoachSecteur(CoachSecteur $coachSecteur): self
  941.     {
  942.         if (!$this->coachSecteurs->contains($coachSecteur)) {
  943.             $this->coachSecteurs[] = $coachSecteur;
  944.             $coachSecteur->setCoach($this);
  945.         }
  946.         return $this;
  947.     }
  948.     public function removeCoachSecteur(CoachSecteur $coachSecteur): self
  949.     {
  950.         if ($this->coachSecteurs->removeElement($coachSecteur)) {
  951.             // set the owning side to null (unless already changed)
  952.             if ($coachSecteur->getCoach() === $this) {
  953.                 $coachSecteur->setCoach(null);
  954.             }
  955.         }
  956.         return $this;
  957.     }
  958.     public function getSecteurByCoach()
  959.     {
  960.         if (in_array(self::ROLE_COACH$this->roles) && $this->coachSecteurs->count() > 0) {
  961.             return $this->coachSecteurs->toArray()[0]->getSecteur();
  962.         }
  963.         return null;
  964.     }
  965.     public function getSecteursIdsByAgent()
  966.     {
  967.         $agentSecteurs $this->getAgentSecteurs();
  968.         $secteurs_ids = [];
  969.         foreach ($agentSecteurs->toArray() as $agentSecteur) {
  970.             $secteurs_ids[] = $agentSecteur->getSecteur()->getId();
  971.         }
  972.         return $secteurs_ids;
  973.     }
  974.     public function getSecteursByAgent()
  975.     {
  976.         $agentSecteurs $this->getAgentSecteurs();
  977.         $secteurs_ids = [];
  978.         foreach ($agentSecteurs->toArray() as $agentSecteur) {
  979.             $secteurs_ids[] = $agentSecteur->getSecteur();
  980.         }
  981.         return $secteurs_ids;
  982.     }
  983.     /**
  984.      * @return Collection<int, AgentSecteur>
  985.      */
  986.     public function getAgentSecteurs(): Collection
  987.     {
  988.         if (in_array(self::ROLE_AGENT$this->roles)) {
  989.             return $this->agentSecteurs;
  990.         }
  991.         $this->agentSecteurs->clear();
  992.         return $this->agentSecteurs;
  993.     }
  994.     public function addAgentSecteur(AgentSecteur $agentSecteur): self
  995.     {
  996.         if (!$this->agentSecteurs->contains($agentSecteur)) {
  997.             $this->agentSecteurs[] = $agentSecteur;
  998.             $agentSecteur->setAgent($this);
  999.         }
  1000.         return $this;
  1001.     }
  1002.     public function removeAgentSecteur(AgentSecteur $agentSecteur): self
  1003.     {
  1004.         if ($this->agentSecteurs->removeElement($agentSecteur)) {
  1005.             // set the owning side to null (unless already changed)
  1006.             if ($agentSecteur->getAgent() === $this) {
  1007.                 $agentSecteur->setAgent(null);
  1008.             }
  1009.         }
  1010.         return $this;
  1011.     }
  1012.     public function getLienCalendly(): ?string
  1013.     {
  1014.         return $this->lienCalendly;
  1015.     }
  1016.     public function setLienCalendly(?string $lienCalendly): self
  1017.     {
  1018.         $this->lienCalendly $lienCalendly;
  1019.         return $this;
  1020.     }
  1021.     /**
  1022.      * @return Collection<int, CategorieFormationAgent>
  1023.      */
  1024.     public function getCategorieFormationAgents(): Collection
  1025.     {
  1026.         return $this->categorieFormationAgents;
  1027.     }
  1028.     public function addCategorieFormationAgent(CategorieFormationAgent $categorieFormationAgent): self
  1029.     {
  1030.         if (!$this->categorieFormationAgents->contains($categorieFormationAgent)) {
  1031.             $this->categorieFormationAgents[] = $categorieFormationAgent;
  1032.             $categorieFormationAgent->setAgent($this);
  1033.         }
  1034.         return $this;
  1035.     }
  1036.     public function removeCategorieFormationAgent(CategorieFormationAgent $categorieFormationAgent): self
  1037.     {
  1038.         if ($this->categorieFormationAgents->removeElement($categorieFormationAgent)) {
  1039.             // set the owning side to null (unless already changed)
  1040.             if ($categorieFormationAgent->getAgent() === $this) {
  1041.                 $categorieFormationAgent->setAgent(null);
  1042.             }
  1043.         }
  1044.         return $this;
  1045.     }
  1046.     public function getUniqueCoachSecteur(): ?Secteur
  1047.     {
  1048.         if (count($this->getCoachSecteurs()) == 0) {
  1049.             throw new Exception("Pas de secteur");
  1050.         }
  1051.         return $this->getCoachSecteurs()[0]->getSecteur();
  1052.     }
  1053.     public function getAgentToken()
  1054.     {
  1055.         return sha1($this->getId());
  1056.     }
  1057.     public function getClientAgent(): ?self
  1058.     {
  1059.         return $this->clientAgent;
  1060.     }
  1061.     public function setClientAgent(?self $clientAgent): self
  1062.     {
  1063.         $this->clientAgent $clientAgent;
  1064.         return $this;
  1065.     }
  1066.     /**
  1067.      * Get the value of plainPassword
  1068.      */
  1069.     public function getPlainPassword()
  1070.     {
  1071.         return $this->plainPassword;
  1072.     }
  1073.     /**
  1074.      * Set the value of plainPassword
  1075.      *
  1076.      * @return  self
  1077.      */
  1078.     public function setPlainPassword($plainPassword)
  1079.     {
  1080.         $this->plainPassword $plainPassword;
  1081.         return $this;
  1082.     }
  1083.     public function getStripeData(): ?array
  1084.     {
  1085.         return $this->stripe_data;
  1086.     }
  1087.     public function setStripeData(?array $stripe_data): self
  1088.     {
  1089.         $this->stripe_data $stripe_data;
  1090.         return $this;
  1091.     }
  1092.     public function getAccountStatus(): ?string
  1093.     {
  1094.         return $this->accountStatus;
  1095.     }
  1096.     public function setAccountStatus(?string $accountStatus): self
  1097.     {
  1098.         $this->accountStatus $accountStatus;
  1099.         return $this;
  1100.     }
  1101.     public function getAccountStartDate(): ?\DateTimeInterface
  1102.     {
  1103.         return $this->accountStartDate;
  1104.     }
  1105.     public function setAccountStartDate(?\DateTimeInterface $accountStartDate): self
  1106.     {
  1107.         $this->accountStartDate $accountStartDate;
  1108.         return $this;
  1109.     }
  1110.     /**
  1111.      * @return Collection<int, SubscriptionPlanAgentAccount>
  1112.      */
  1113.     public function getSubscriptionPlanAgentAccounts(): Collection
  1114.     {
  1115.         return $this->subscriptionPlanAgentAccounts;
  1116.     }
  1117.     public function addSubscriptionPlanAgentAccount(SubscriptionPlanAgentAccount $subscriptionPlanAgentAccount): self
  1118.     {
  1119.         if (!$this->subscriptionPlanAgentAccounts->contains($subscriptionPlanAgentAccount)) {
  1120.             $this->subscriptionPlanAgentAccounts[] = $subscriptionPlanAgentAccount;
  1121.             $subscriptionPlanAgentAccount->setUser($this);
  1122.         }
  1123.         return $this;
  1124.     }
  1125.     public function removeSubscriptionPlanAgentAccount(SubscriptionPlanAgentAccount $subscriptionPlanAgentAccount): self
  1126.     {
  1127.         if ($this->subscriptionPlanAgentAccounts->removeElement($subscriptionPlanAgentAccount)) {
  1128.             // set the owning side to null (unless already changed)
  1129.             if ($subscriptionPlanAgentAccount->getUser() === $this) {
  1130.                 $subscriptionPlanAgentAccount->setUser(null);
  1131.             }
  1132.         }
  1133.         return $this;
  1134.     }
  1135.     public function getStripeCustomerId(): ?string
  1136.     {
  1137.         return $this->stripeCustomerId;
  1138.     }
  1139.     public function setStripeCustomerId(?string $stripeCustomerId): self
  1140.     {
  1141.         $this->stripeCustomerId $stripeCustomerId;
  1142.         return $this;
  1143.     }
  1144.     /**
  1145.      * @return Collection<int, OrderDigital>
  1146.      */
  1147.     public function getOrderDigitals(): Collection
  1148.     {
  1149.         return $this->orderDigitals;
  1150.     }
  1151.     public function addOrderDigital(OrderDigital $orderDigital): self
  1152.     {
  1153.         if (!$this->orderDigitals->contains($orderDigital)) {
  1154.             $this->orderDigitals[] = $orderDigital;
  1155.             $orderDigital->setAgent($this);
  1156.         }
  1157.         return $this;
  1158.     }
  1159.     public function removeOrderDigital(OrderDigital $orderDigital): self
  1160.     {
  1161.         if ($this->orderDigitals->removeElement($orderDigital)) {
  1162.             // set the owning side to null (unless already changed)
  1163.             if ($orderDigital->getAgent() === $this) {
  1164.                 $orderDigital->setAgent(null);
  1165.             }
  1166.         }
  1167.         return $this;
  1168.     }
  1169.     public function getNumeroRue(): ?string
  1170.     {
  1171.         return $this->numero_rue;
  1172.     }
  1173.     public function setNumeroRue(?string $numero_rue): self
  1174.     {
  1175.         $this->numero_rue $numero_rue;
  1176.         return $this;
  1177.     }
  1178.     /**
  1179.      * @return Collection<int, DevisCompany>
  1180.      */
  1181.     public function getDevisCompanies(): Collection
  1182.     {
  1183.         return $this->devisCompanies;
  1184.     }
  1185.     public function addDevisCompany(DevisCompany $devisCompany): self
  1186.     {
  1187.         if (!$this->devisCompanies->contains($devisCompany)) {
  1188.             $this->devisCompanies[] = $devisCompany;
  1189.             $devisCompany->setAgent($this);
  1190.         }
  1191.         return $this;
  1192.     }
  1193.     public function getVille(): ?string
  1194.     {
  1195.         return $this->ville;
  1196.     }
  1197.     public function setVille(?string $ville): self
  1198.     {
  1199.         $this->ville $ville;
  1200.         return $this;
  1201.     }
  1202.     public function removeDevisCompany(DevisCompany $devisCompany): self
  1203.     {
  1204.         if ($this->devisCompanies->removeElement($devisCompany)) {
  1205.             // set the owning side to null (unless already changed)
  1206.             if ($devisCompany->getAgent() === $this) {
  1207.                 $devisCompany->setAgent(null);
  1208.             }
  1209.         }
  1210.         return $this;
  1211.     }
  1212.     public function getParrain(): ?self
  1213.     {
  1214.         return $this->parrain;
  1215.     }
  1216.     public function setParrain(?self $parrain): static
  1217.     {
  1218.         $this->parrain $parrain;
  1219.         return $this;
  1220.     }
  1221.     /**
  1222.      * @return Collection<int, User>
  1223.      */
  1224.     public function getFils(): Collection
  1225.     {
  1226.         return $this->fils;
  1227.     }
  1228.     public function addFil(User $fil): static
  1229.     {
  1230.         if (!$this->fils->contains($fil)) {
  1231.             $this->fils->add($fil);
  1232.             $fil->setParrain($this);
  1233.         }
  1234.         return $this;
  1235.     }
  1236.     public function removeFil(User $fil): static
  1237.     {
  1238.         if ($this->fils->removeElement($fil)) {
  1239.             // set the owning side to null (unless already changed)
  1240.             if ($fil->getParrain() === $this) {
  1241.                 $fil->setParrain(null);
  1242.             }
  1243.         }
  1244.         return $this;
  1245.     }
  1246.     public function countFils()
  1247.     {
  1248.         return count($this->fils);
  1249.     }
  1250.     public function jsonSerialize()
  1251.     {
  1252.         /* $vars = get_object_vars($this);
  1253.         unset($vars['password']);
  1254.         unset($vars['roles']);
  1255.         unset($vars['coachAgents']);
  1256.         unset($vars['liveChatVideosFromUserA']);
  1257.         unset($vars['liveChatVideosFromUserB']);
  1258.         unset($vars['videoFormations']);
  1259.         unset($vars['commentaires']);
  1260.         unset($vars['messages']);
  1261.         unset($vars['canalMessages']);
  1262.         unset($vars['created_at']);
  1263.         unset($vars['contact']);
  1264.         unset($vars['formations']);
  1265.         unset($vars['formationAgents']);
  1266.         unset($vars['coachSecteurs']);
  1267.         unset($vars['agentSecteurs']);
  1268.         unset($vars['calendarEvents']);
  1269.         unset($vars['categorieFormationAgents']);
  1270.         unset($vars['meetings']);
  1271.         unset($vars['meetingGuests']);
  1272.         unset($vars['subscriptionPlanAgentAccounts']);
  1273.         unset($vars['orderDigitals']);
  1274.         unset($vars['devisCompanies']);*/
  1275.         $vars = [
  1276.             'id' => $this->getId(),
  1277.             'email' => $this->getEmail(),
  1278.             'userIdentifer' => $this->getUserIdentifier(),
  1279.             'nom' => $this->getNom(),
  1280.             'prenom' => $this->getPrenom(),
  1281.             'role' => $this->getRoles()
  1282.         ];
  1283.         return $vars;
  1284.     }
  1285.     /**
  1286.      * @return Collection<int, LiveChatVideo>
  1287.      */
  1288.     public function getLiveChatVideosFromUserA(): Collection
  1289.     {
  1290.         return $this->liveChatVideosFromUserA;
  1291.     }
  1292.     public function addLiveChatVideosFromUserA(LiveChatVideo $liveChatVideosFromUserA): static
  1293.     {
  1294.         if (!$this->liveChatVideosFromUserA->contains($liveChatVideosFromUserA)) {
  1295.             $this->liveChatVideosFromUserA->add($liveChatVideosFromUserA);
  1296.             $liveChatVideosFromUserA->setUserA($this);
  1297.         }
  1298.         return $this;
  1299.     }
  1300.     public function removeLiveChatVideosFromUserA(LiveChatVideo $liveChatVideosFromUserA): static
  1301.     {
  1302.         if ($this->liveChatVideosFromUserA->removeElement($liveChatVideosFromUserA)) {
  1303.             // set the owning side to null (unless already changed)
  1304.             if ($liveChatVideosFromUserA->getUserA() === $this) {
  1305.                 $liveChatVideosFromUserA->setUserA(null);
  1306.             }
  1307.         }
  1308.         return $this;
  1309.     }
  1310.     /**
  1311.      * @return Collection<int, LiveChatVideo>
  1312.      */
  1313.     public function getLiveChatVideosFromUserB(): Collection
  1314.     {
  1315.         return $this->liveChatVideosFromUserB;
  1316.     }
  1317.     public function addLiveChatVideosFromUserB(LiveChatVideo $liveChatVideosFromUserB): static
  1318.     {
  1319.         if (!$this->liveChatVideosFromUserB->contains($liveChatVideosFromUserB)) {
  1320.             $this->liveChatVideosFromUserB->add($liveChatVideosFromUserB);
  1321.             $liveChatVideosFromUserB->setUserB($this);
  1322.         }
  1323.         return $this;
  1324.     }
  1325.     public function removeLiveChatVideosFromUserB(LiveChatVideo $liveChatVideosFromUserB): static
  1326.     {
  1327.         if ($this->liveChatVideosFromUserB->removeElement($liveChatVideosFromUserB)) {
  1328.             // set the owning side to null (unless already changed)
  1329.             if ($liveChatVideosFromUserB->getUserB() === $this) {
  1330.                 $liveChatVideosFromUserB->setUserB(null);
  1331.             }
  1332.         }
  1333.         return $this;
  1334.     }
  1335.     /**
  1336.      * @return Collection<int, CalendarEvent>
  1337.      */
  1338.     public function getCalendarEvents(): Collection
  1339.     {
  1340.         return $this->calendarEvents;
  1341.     }
  1342.     public function addCalendarEvent(CalendarEvent $calendarEvent): static
  1343.     {
  1344.         if (!$this->calendarEvents->contains($calendarEvent)) {
  1345.             $this->calendarEvents->add($calendarEvent);
  1346.             $calendarEvent->setUser($this);
  1347.         }
  1348.         return $this;
  1349.     }
  1350.     public function removeCalendarEvent(CalendarEvent $calendarEvent): static
  1351.     {
  1352.         if ($this->calendarEvents->removeElement($calendarEvent)) {
  1353.             // set the owning side to null (unless already changed)
  1354.             if ($calendarEvent->getUser() === $this) {
  1355.                 $calendarEvent->setUser(null);
  1356.             }
  1357.         }
  1358.         return $this;
  1359.     }
  1360.     /**
  1361.      * @return Collection<int, Meeting>
  1362.      */
  1363.     public function getMeetings(): Collection
  1364.     {
  1365.         return $this->meetings;
  1366.     }
  1367.     public function addMeeting(Meeting $meeting): static
  1368.     {
  1369.         if (!$this->meetings->contains($meeting)) {
  1370.             $this->meetings->add($meeting);
  1371.             $meeting->setUser($this);
  1372.         }
  1373.         return $this;
  1374.     }
  1375.     public function removeMeeting(Meeting $meeting): static
  1376.     {
  1377.         if ($this->meetings->removeElement($meeting)) {
  1378.             // set the owning side to null (unless already changed)
  1379.             if ($meeting->getUser() === $this) {
  1380.                 $meeting->setUser(null);
  1381.             }
  1382.         }
  1383.         return $this;
  1384.     }
  1385.     /**
  1386.      * @return Collection<int, Meeting>
  1387.      */
  1388.     public function getMeetingGuests(): Collection
  1389.     {
  1390.         return $this->meetingGuests;
  1391.     }
  1392.     public function addMeetingGuest(Meeting $meetingGuest): static
  1393.     {
  1394.         if (!$this->meetingGuests->contains($meetingGuest)) {
  1395.             $this->meetingGuests->add($meetingGuest);
  1396.             $meetingGuest->setUserToMeet($this);
  1397.         }
  1398.         return $this;
  1399.     }
  1400.     public function removeMeetingGuest(Meeting $meetingGuest): static
  1401.     {
  1402.         if ($this->meetingGuests->removeElement($meetingGuest)) {
  1403.             // set the owning side to null (unless already changed)
  1404.             if ($meetingGuest->getUserToMeet() === $this) {
  1405.                 $meetingGuest->setUserToMeet(null);
  1406.             }
  1407.         }
  1408.         return $this;
  1409.     }
  1410.     public function canAccessFonct(string $fonct$secteurId): bool{
  1411.         return in_array($fonct$this->getAccessibleFonctionnalites($secteurId) ?? [] );
  1412.     }
  1413. }