src/Entity/User.php line 36

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Actualites\Actualites;
  4. use App\Entity\Articles\Articles;
  5. use App\Entity\Common\IdTrait;
  6. use App\Entity\Hotels\Hotels;
  7. use App\Entity\Logs\Logs;
  8. use App\Entity\Posts\Posts;
  9. use App\Entity\Restaurants\Restaurants;
  10. use App\Entity\Salons\Salons;
  11. use DateTime;
  12. use DateTimeImmutable;
  13. use DateTimeInterface;
  14. use Doctrine\Common\Collections\ArrayCollection;
  15. use Doctrine\Common\Collections\Collection;
  16. use Exception;
  17. use Symfony\Component\HttpFoundation\File\File;
  18. use Symfony\Component\HttpFoundation\File\UploadedFile;
  19. use Symfony\Component\PasswordHasher\Hasher\PasswordHasherAwareInterface;
  20. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  21. use Symfony\Component\Validator\Constraints as Assert;
  22. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  23. use Gedmo\Mapping\Annotation as Gedmo;
  24. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  25. use Doctrine\ORM\Mapping as ORM;
  26. use Symfony\Component\Security\Core\User\UserInterface;
  27. /**
  28.  * @ORM\Entity(repositoryClass="App\Repository\UserRepository")
  29.  * @Vich\Uploadable
  30.  * @UniqueEntity("email", message="Cet utilisateur existe déjà, veuillez réessayer")
  31.  * @method string getUserIdentifier()
  32.  */
  33. class User implements UserInterfacePasswordHasherAwareInterfacePasswordAuthenticatedUserInterface
  34. {
  35.     const ROLES = [
  36.         'ROLE_SUPER_ADMIN' => 'Super administrateur',
  37.         'ROLE_ADMIN' => 'Administrateur',
  38.         'ROLE_USER' => 'Utilisateur',
  39.     ];
  40.     const ROLESPUBLIC = [
  41.         'ROLE_HOTELLERIE' => 'Hôtelleries',
  42.         'ROLE_RESTAURATION' => 'Restaurations',
  43.         'ROLE_AGENCEVOYAGE' => 'Agence de voyages',
  44.         'ROLE_LOISIR' => 'Loisirs',
  45.         'ROLE_TRANSPORT' => 'Transports',
  46.     ];
  47.     use IdTrait;
  48.     /**
  49.      * @ORM\Column(type="string", length=180, unique=true)
  50.      * @Assert\NotBlank(message="Veuillez saisir une adresse email")
  51.      * @Assert\Email(message="Veuillez saisir un email valide")
  52.      */
  53.     private $email;
  54.     /**
  55.      * @ORM\Column(type="array")
  56.      */
  57.     private $roles;
  58.     /**
  59.      * @var string
  60.      */
  61.     private $role;
  62.     /**
  63.      * @var string The hashed password
  64.      * @ORM\Column(type="string")
  65.      * @Assert\NotBlank(message="Veuillez saisir un mot de passe")
  66.      * @Assert\Length(min="6", minMessage="Votre mot de passe doit comporter au minimum 6 cataères")
  67.      */
  68.     private $password;
  69.     /**
  70.      * @ORM\Column(type="string", length=255)
  71.      * @Assert\NotBlank(message="Veuillez saisir un nom d'utilisateur")
  72.      */
  73.     private $username;
  74.     /**
  75.      * @ORM\Column(type="string", length=50, nullable=true)
  76.      * @Assert\NotBlank(message="Veuillez saisir un numéro de téléphone")
  77.      */
  78.     private $contacts;
  79.     /**
  80.      * @ORM\Column(type="string", length=255, nullable=true)
  81.      */
  82.     private $address;
  83.     /**
  84.      * NOTE: This is not a mapped field of entity metadata, just a simple property.
  85.      *
  86.      * @Vich\UploadableField(mapping="photos", fileNameProperty="filename")
  87.      * @var File|null
  88.      * @Assert\Image(
  89.      *     mimeTypes={"image/jpeg", "image/png"},
  90.      *     maxHeight=500,
  91.      *     maxWidth=600,
  92.      * )
  93.      */
  94.     private $imageFile;
  95.     /**
  96.      * @var string|null
  97.      * @ORM\Column(type="string", length=255, nullable=true)
  98.      */
  99.     private $filename;
  100.     /**
  101.      * @ORM\Column(type="boolean", options={"default": 0})
  102.      */
  103.     private $enabled;
  104.     /**
  105.      * @var DateTime $createdAt
  106.      * @ORM\Column(type="datetime")
  107.      *
  108.      * @Gedmo\Timestampable(on="create")
  109.      */
  110.     private $createdAt;
  111.     /**
  112.      * @var DateTime $updatedAt
  113.      * @ORM\Column(type="datetime", nullable=true)
  114.      *
  115.      * @Gedmo\Timestampable(on="update")
  116.      */
  117.     private $updatedAt;
  118.     /**
  119.      * @ORM\Column(type="datetime", nullable=true)
  120.      */
  121.     private $lastLogin;
  122.     /**
  123.      * @ORM\OneToMany(targetEntity="App\Entity\Actualites\Actualites", mappedBy="user")
  124.      */
  125.     private $actualites;
  126.     /**
  127.      * @ORM\Column(type="string", length=255, nullable=true)
  128.      * @Assert\NotBlank(message="Veuillez saisir votre nom de famille")
  129.      * @Assert\Length(
  130.      *     min="3", minMessage="Le nom doit comporter au minimum 3 cataères",
  131.      *     max="15", maxMessage="Le nom doit comporter au plus 15 cataères",
  132.      * )
  133.      */
  134.     private $nom;
  135.     /**
  136.      * @ORM\Column(type="string", length=255, nullable=true)
  137.      * @Assert\NotBlank(message="Veuillez saisir votre prenom")
  138.      * @Assert\Length(
  139.      *     min="3", minMessage="Le prenom doit comporter au minimum 3 cataères",
  140.      *     max="100", maxMessage="Le prenom doit comporter au plus 100 cataères",
  141.      * )
  142.      */
  143.     private $prenoms;
  144.     /**
  145.      * @ORM\OneToMany(targetEntity="App\Entity\Logs\Logs", mappedBy="user")
  146.      */
  147.     private $logs;
  148.     /**
  149.      * @ORM\OneToMany(targetEntity="App\Entity\Institutions", mappedBy="user")
  150.      */
  151.     private $institutions;
  152.     /**
  153.      * @ORM\OneToMany(targetEntity="App\Entity\Actualites\Actualites", mappedBy="updatedBy")
  154.      */
  155.     private $actualitesUpatedBy;
  156.     /**
  157.      * @ORM\OneToMany(targetEntity="App\Entity\Brochures", mappedBy="user")
  158.      */
  159.     private $brochures;
  160.     /**
  161.      * @ORM\OneToMany(targetEntity="App\Entity\Articles\Articles", mappedBy="user")
  162.      */
  163.     private $articles;
  164.     /**
  165.      * @ORM\OneToMany(targetEntity="App\Entity\Posts\Posts", mappedBy="user")
  166.      */
  167.     private $posts;
  168.     /**
  169.      * @ORM\OneToMany(targetEntity="App\Entity\Directions", mappedBy="user")
  170.      */
  171.     private $directions;
  172.     /**
  173.      * @ORM\OneToMany(targetEntity="App\Entity\Partenaires", mappedBy="user")
  174.      */
  175.     private $partenaires;
  176.     /**
  177.      * @ORM\OneToMany(targetEntity="App\Entity\Documentations", mappedBy="user")
  178.      */
  179.     private $documentations;
  180.     /**
  181.      * @ORM\OneToMany(targetEntity="App\Entity\Salons\Salons", mappedBy="user")
  182.      */
  183.     private $salons;
  184.     /**
  185.      * @ORM\OneToMany(targetEntity="App\Entity\Seminaires", mappedBy="user")
  186.      */
  187.     private $seminaires;
  188.     /**
  189.      * @ORM\ManyToOne(targetEntity="App\Entity\Categorieacteurs", inversedBy="user")
  190.      */
  191.     private $domaines;
  192.     /**
  193.      * @ORM\OneToMany(targetEntity="App\Entity\Hotels\Hotels", mappedBy="user")
  194.      */
  195.     private $hotels;
  196.     /**
  197.      * @ORM\OneToMany(targetEntity="App\Entity\Restaurants\Restaurants", mappedBy="user")
  198.      */
  199.     private $restaurants;
  200.     public function __construct()
  201.     {
  202.         $this->roles = ['ROLE_USER'];
  203.         $this->actualites = new ArrayCollection();
  204.         $this->logs = new ArrayCollection();
  205.         $this->institutions = new ArrayCollection();
  206.         $this->actualitesUpatedBy = new ArrayCollection();
  207.         $this->brochures = new ArrayCollection();
  208.         $this->articles = new ArrayCollection();
  209.         $this->posts = new ArrayCollection();
  210.         $this->directions = new ArrayCollection();
  211.         $this->partenaires = new ArrayCollection();
  212.         $this->documentations = new ArrayCollection();
  213.         $this->salons = new ArrayCollection();
  214.         $this->seminaires = new ArrayCollection();
  215.         $this->hotels = new ArrayCollection();
  216.         $this->restaurants = new ArrayCollection();
  217.     }
  218.     public function getEmail(): ?string
  219.     {
  220.         return $this->email;
  221.     }
  222.     public function setEmail(string $email): self
  223.     {
  224.         $this->email $email;
  225.         return $this;
  226.     }
  227.     /**
  228.      * A visual identifier that represents this user.
  229.      *
  230.      * @see UserInterface
  231.      */
  232.     public function getUsername(): ?string
  233.     {
  234.         return $this->username;
  235.     }
  236.     /**
  237.      * @return string|null
  238.      */
  239.     public function getFullname(): ?string
  240.     {
  241.         return $this->nom' '.$this->prenoms;
  242.     }
  243.     /**
  244.      * @see UserInterface
  245.      */
  246.     public function getRoles(): array
  247.     {
  248.         $roles $this->roles;
  249.         // guarantee every user at least has ROLE_USER
  250.         $roles[] = 'ROLE_USER';
  251.         return array_unique($roles);
  252.     }
  253.     public function setRoles(array $roles): self
  254.     {
  255.         $this->roles $roles;
  256.         return $this;
  257.     }
  258.     /**
  259.      * @return string
  260.      */
  261.     public function getRole(): ?string
  262.     {
  263.         return $this->role;
  264.     }
  265.     /**
  266.      * @param string|null $role
  267.      * @return User
  268.      */
  269.     public function setRole(?string $role): User
  270.     {
  271.         $this->role $role;
  272.         return $this;
  273.     }
  274.     public function getRolesType(): string {
  275.         return self::ROLESPUBLIC[$this->role];
  276.     }
  277.     /**
  278.      * @see UserInterface
  279.      */
  280.     public function getPassword(): ?string
  281.     {
  282.         return $this->password;
  283.     }
  284.     public function setPassword(string $password): self
  285.     {
  286.         $this->password $password;
  287.         return $this;
  288.     }
  289.     /**
  290.      * @see UserInterface
  291.      */
  292.     public function getSalt(): ?string
  293.     {
  294.         return '';
  295.     }
  296.     /**
  297.      * @see UserInterface
  298.      */
  299.     public function eraseCredentials()
  300.     {
  301.         // If you store any temporary, sensitive data on the user, clear it here
  302.         // $this->plainPassword = null;
  303.     }
  304.     public function setUsername(string $username): self
  305.     {
  306.         $this->username $username;
  307.         return $this;
  308.     }
  309.     public function getContacts(): ?string
  310.     {
  311.         return $this->contacts;
  312.     }
  313.     public function setContacts(?string $contacts): self
  314.     {
  315.         $this->contacts $contacts;
  316.         return $this;
  317.     }
  318.     public function getAddress(): ?string
  319.     {
  320.         return $this->address;
  321.     }
  322.     public function setAddress(?string $address): self
  323.     {
  324.         $this->address $address;
  325.         return $this;
  326.     }
  327.     /**
  328.      * @return File|null
  329.      */
  330.     public function getImageFile(): ?File
  331.     {
  332.         return $this->imageFile;
  333.     }
  334.     /**
  335.      * @param File|null $imageFile
  336.      * @return User
  337.      * @throws Exception
  338.      */
  339.     public function setImageFile(?File $imageFile): User
  340.     {
  341.         $this->imageFile $imageFile;
  342.         if ($this->imageFile instanceof UploadedFile) {
  343.             // It is required that at least one field changes if you are using doctrine
  344.             // otherwise the event listeners won't be called and the file is lost
  345.             $this->updatedAt = new DateTimeImmutable('now');
  346.         }
  347.         return $this;
  348.     }
  349.     /**
  350.      * @return string|null
  351.      */
  352.     public function getFilename(): ?string
  353.     {
  354.         return $this->filename;
  355.     }
  356.     /**
  357.      * @param string|null $filename
  358.      * @return User
  359.      */
  360.     public function setFilename(?string $filename): User
  361.     {
  362.         $this->filename $filename;
  363.         return $this;
  364.     }
  365.     /**
  366.      * @return mixed
  367.      */
  368.     public function getEnabled()
  369.     {
  370.         return $this->enabled;
  371.     }
  372.     /**
  373.      * @param mixed $enabled
  374.      * @return User
  375.      */
  376.     public function setEnabled($enabled): User
  377.     {
  378.         $this->enabled $enabled;
  379.         return $this;
  380.     }
  381.     public function getCreatedAt(): ?DateTimeInterface
  382.     {
  383.         return $this->createdAt;
  384.     }
  385.     public function getUpdatedAt(): ?DateTimeInterface
  386.     {
  387.         return $this->updatedAt;
  388.     }
  389.     public function getLastLogin(): ?DateTimeInterface
  390.     {
  391.         return $this->lastLogin;
  392.     }
  393.     public function setLastLogin(DateTimeInterface $lastLogin): self
  394.     {
  395.         $this->lastLogin $lastLogin;
  396.         return $this;
  397.     }
  398.     /**
  399.      * @return Collection|Actualites[]
  400.      */
  401.     public function getActualites(): Collection
  402.     {
  403.         return $this->actualites;
  404.     }
  405.     /**
  406.      * @param Actualites $actualite
  407.      * @return $this
  408.      */
  409.     public function addActualite(Actualites $actualite): self
  410.     {
  411.         if (!$this->actualites->contains($actualite)) {
  412.             $this->actualites[] = $actualite;
  413.             $actualite->setUser($this);
  414.         }
  415.         return $this;
  416.     }
  417.     public function removeActualite(Actualites $actualite): self
  418.     {
  419.         if ($this->actualites->contains($actualite)) {
  420.             $this->actualites->removeElement($actualite);
  421.             // set the owning side to null (unless already changed)
  422.             if ($actualite->getUser() === $this) {
  423.                 $actualite->setUser(null);
  424.             }
  425.         }
  426.         return $this;
  427.     }
  428.     public function getNom(): ?string
  429.     {
  430.         return $this->nom;
  431.     }
  432.     public function setNom(string $nom): self
  433.     {
  434.         $this->nom $nom;
  435.         return $this;
  436.     }
  437.     public function getPrenoms(): ?string
  438.     {
  439.         return $this->prenoms;
  440.     }
  441.     public function setPrenoms(string $prenoms): self
  442.     {
  443.         $this->prenoms $prenoms;
  444.         return $this;
  445.     }
  446.     /**
  447.      * @return Collection|Logs[]
  448.      */
  449.     public function getLogs(): Collection
  450.     {
  451.         return $this->logs;
  452.     }
  453.     public function addLog(Logs $log): self
  454.     {
  455.         if (!$this->logs->contains($log)) {
  456.             $this->logs[] = $log;
  457.             $log->setUser($this);
  458.         }
  459.         return $this;
  460.     }
  461.     public function removeLog(Logs $log): self
  462.     {
  463.         if ($this->logs->contains($log)) {
  464.             $this->logs->removeElement($log);
  465.             // set the owning side to null (unless already changed)
  466.             if ($log->getUser() === $this) {
  467.                 $log->setUser(null);
  468.             }
  469.         }
  470.         return $this;
  471.     }
  472.     /**
  473.      * @return Collection|Institutions[]
  474.      */
  475.     public function getInstitutions(): Collection
  476.     {
  477.         return $this->institutions;
  478.     }
  479.     public function addInstitution(Institutions $institution): self
  480.     {
  481.         if (!$this->institutions->contains($institution)) {
  482.             $this->institutions[] = $institution;
  483.             $institution->setUser($this);
  484.         }
  485.         return $this;
  486.     }
  487.     public function removeInstitution(Institutions $institution): self
  488.     {
  489.         if ($this->institutions->contains($institution)) {
  490.             $this->institutions->removeElement($institution);
  491.             // set the owning side to null (unless already changed)
  492.             if ($institution->getUser() === $this) {
  493.                 $institution->setUser(null);
  494.             }
  495.         }
  496.         return $this;
  497.     }
  498.     /**
  499.      * @return Collection|Actualites[]
  500.      */
  501.     public function getActualitesUpatedBy(): Collection
  502.     {
  503.         return $this->actualitesUpatedBy;
  504.     }
  505.     public function addActualitesUpatedBy(Actualites $actualitesUpatedBy): self
  506.     {
  507.         if (!$this->actualitesUpatedBy->contains($actualitesUpatedBy)) {
  508.             $this->actualitesUpatedBy[] = $actualitesUpatedBy;
  509.             $actualitesUpatedBy->setUpdatedBy($this);
  510.         }
  511.         return $this;
  512.     }
  513.     public function removeActualitesUpatedBy(Actualites $actualitesUpatedBy): self
  514.     {
  515.         if ($this->actualitesUpatedBy->contains($actualitesUpatedBy)) {
  516.             $this->actualitesUpatedBy->removeElement($actualitesUpatedBy);
  517.             // set the owning side to null (unless already changed)
  518.             if ($actualitesUpatedBy->getUpdatedBy() === $this) {
  519.                 $actualitesUpatedBy->setUpdatedBy(null);
  520.             }
  521.         }
  522.         return $this;
  523.     }
  524.     /**
  525.      * @return Collection|Brochures[]
  526.      */
  527.     public function getBrochures(): Collection
  528.     {
  529.         return $this->brochures;
  530.     }
  531.     public function addBrochure(Brochures $brochure): self
  532.     {
  533.         if (!$this->brochures->contains($brochure)) {
  534.             $this->brochures[] = $brochure;
  535.             $brochure->setUser($this);
  536.         }
  537.         return $this;
  538.     }
  539.     public function removeBrochure(Brochures $brochure): self
  540.     {
  541.         if ($this->brochures->contains($brochure)) {
  542.             $this->brochures->removeElement($brochure);
  543.             // set the owning side to null (unless already changed)
  544.             if ($brochure->getUser() === $this) {
  545.                 $brochure->setUser(null);
  546.             }
  547.         }
  548.         return $this;
  549.     }
  550.     /**
  551.      * @return Collection|Articles[]
  552.      */
  553.     public function getArticles(): Collection
  554.     {
  555.         return $this->articles;
  556.     }
  557.     public function addArticle(Articles $article): self
  558.     {
  559.         if (!$this->articles->contains($article)) {
  560.             $this->articles[] = $article;
  561.             $article->setUser($this);
  562.         }
  563.         return $this;
  564.     }
  565.     public function removeArticle(Articles $article): self
  566.     {
  567.         if ($this->articles->contains($article)) {
  568.             $this->articles->removeElement($article);
  569.             // set the owning side to null (unless already changed)
  570.             if ($article->getUser() === $this) {
  571.                 $article->setUser(null);
  572.             }
  573.         }
  574.         return $this;
  575.     }
  576.     /**
  577.      * @return Collection|Posts[]
  578.      */
  579.     public function getPosts(): Collection
  580.     {
  581.         return $this->posts;
  582.     }
  583.     public function addPost(Posts $post): self
  584.     {
  585.         if (!$this->posts->contains($post)) {
  586.             $this->posts[] = $post;
  587.             $post->setUser($this);
  588.         }
  589.         return $this;
  590.     }
  591.     public function removePost(Posts $post): self
  592.     {
  593.         if ($this->posts->contains($post)) {
  594.             $this->posts->removeElement($post);
  595.             // set the owning side to null (unless already changed)
  596.             if ($post->getUser() === $this) {
  597.                 $post->setUser(null);
  598.             }
  599.         }
  600.         return $this;
  601.     }
  602.     /**
  603.      * @return Collection|Directions[]
  604.      */
  605.     public function getDirections(): Collection
  606.     {
  607.         return $this->directions;
  608.     }
  609.     public function addDirection(Directions $direction): self
  610.     {
  611.         if (!$this->directions->contains($direction)) {
  612.             $this->directions[] = $direction;
  613.             $direction->setUser($this);
  614.         }
  615.         return $this;
  616.     }
  617.     public function removeDirection(Directions $direction): self
  618.     {
  619.         if ($this->directions->contains($direction)) {
  620.             $this->directions->removeElement($direction);
  621.             // set the owning side to null (unless already changed)
  622.             if ($direction->getUser() === $this) {
  623.                 $direction->setUser(null);
  624.             }
  625.         }
  626.         return $this;
  627.     }
  628.     /**
  629.      * @return Collection|Partenaires[]
  630.      */
  631.     public function getPartenaires(): Collection
  632.     {
  633.         return $this->partenaires;
  634.     }
  635.     public function addPartenaire(Partenaires $partenaire): self
  636.     {
  637.         if (!$this->partenaires->contains($partenaire)) {
  638.             $this->partenaires[] = $partenaire;
  639.             $partenaire->setUser($this);
  640.         }
  641.         return $this;
  642.     }
  643.     public function removePartenaire(Partenaires $partenaire): self
  644.     {
  645.         if ($this->partenaires->contains($partenaire)) {
  646.             $this->partenaires->removeElement($partenaire);
  647.             // set the owning side to null (unless already changed)
  648.             if ($partenaire->getUser() === $this) {
  649.                 $partenaire->setUser(null);
  650.             }
  651.         }
  652.         return $this;
  653.     }
  654.     /**
  655.      * @return Collection|Documentations[]
  656.      */
  657.     public function getDocumentations(): Collection
  658.     {
  659.         return $this->documentations;
  660.     }
  661.     public function addDocumentation(Documentations $documentation): self
  662.     {
  663.         if (!$this->documentations->contains($documentation)) {
  664.             $this->documentations[] = $documentation;
  665.             $documentation->setUser($this);
  666.         }
  667.         return $this;
  668.     }
  669.     public function removeDocumentation(Documentations $documentation): self
  670.     {
  671.         if ($this->documentations->contains($documentation)) {
  672.             $this->documentations->removeElement($documentation);
  673.             // set the owning side to null (unless already changed)
  674.             if ($documentation->getUser() === $this) {
  675.                 $documentation->setUser(null);
  676.             }
  677.         }
  678.         return $this;
  679.     }
  680.     /**
  681.      * @return Collection|Salons[]
  682.      */
  683.     public function getSalons(): Collection
  684.     {
  685.         return $this->salons;
  686.     }
  687.     public function addSalon(Salons $salon): self
  688.     {
  689.         if (!$this->salons->contains($salon)) {
  690.             $this->salons[] = $salon;
  691.             $salon->setUser($this);
  692.         }
  693.         return $this;
  694.     }
  695.     public function removeSalon(Salons $salon): self
  696.     {
  697.         if ($this->salons->contains($salon)) {
  698.             $this->salons->removeElement($salon);
  699.             // set the owning side to null (unless already changed)
  700.             if ($salon->getUser() === $this) {
  701.                 $salon->setUser(null);
  702.             }
  703.         }
  704.         return $this;
  705.     }
  706.     /**
  707.      * @return Collection|Seminaires[]
  708.      */
  709.     public function getSeminaires(): Collection
  710.     {
  711.         return $this->seminaires;
  712.     }
  713.     public function addSeminaire(Seminaires $seminaire): self
  714.     {
  715.         if (!$this->seminaires->contains($seminaire)) {
  716.             $this->seminaires[] = $seminaire;
  717.             $seminaire->setUser($this);
  718.         }
  719.         return $this;
  720.     }
  721.     public function removeSeminaire(Seminaires $seminaire): self
  722.     {
  723.         if ($this->seminaires->contains($seminaire)) {
  724.             $this->seminaires->removeElement($seminaire);
  725.             // set the owning side to null (unless already changed)
  726.             if ($seminaire->getUser() === $this) {
  727.                 $seminaire->setUser(null);
  728.             }
  729.         }
  730.         return $this;
  731.     }
  732.     public function getDomaines(): ?Categorieacteurs
  733.     {
  734.         return $this->domaines;
  735.     }
  736.     public function setDomaines(?Categorieacteurs $domaines): self
  737.     {
  738.         $this->domaines $domaines;
  739.         return $this;
  740.     }
  741.     /**
  742.      * @return Collection|Hotels[]
  743.      */
  744.     public function getHotels(): Collection
  745.     {
  746.         return $this->hotels;
  747.     }
  748.     public function addHotel(Hotels $hotel): self
  749.     {
  750.         if (!$this->hotels->contains($hotel)) {
  751.             $this->hotels[] = $hotel;
  752.             $hotel->setUser($this);
  753.         }
  754.         return $this;
  755.     }
  756.     public function removeHotel(Hotels $hotel): self
  757.     {
  758.         if ($this->hotels->contains($hotel)) {
  759.             $this->hotels->removeElement($hotel);
  760.             // set the owning side to null (unless already changed)
  761.             if ($hotel->getUser() === $this) {
  762.                 $hotel->setUser(null);
  763.             }
  764.         }
  765.         return $this;
  766.     }
  767.     /**
  768.      * @return Collection|Restaurants[]
  769.      */
  770.     public function getRestaurants(): Collection
  771.     {
  772.         return $this->restaurants;
  773.     }
  774.     public function addRestaurant(Restaurants $restaurant): self
  775.     {
  776.         if (!$this->restaurants->contains($restaurant)) {
  777.             $this->restaurants[] = $restaurant;
  778.             $restaurant->setUser($this);
  779.         }
  780.         return $this;
  781.     }
  782.     public function removeRestaurant(Restaurants $restaurant): self
  783.     {
  784.         if ($this->restaurants->contains($restaurant)) {
  785.             $this->restaurants->removeElement($restaurant);
  786.             // set the owning side to null (unless already changed)
  787.             if ($restaurant->getUser() === $this) {
  788.                 $restaurant->setUser(null);
  789.             }
  790.         }
  791.         return $this;
  792.     }
  793.     /**
  794.      * @return string
  795.      */
  796.     public function __toString(): string
  797.     {
  798.         return $this->nom' '$this->prenoms;
  799.     }
  800.     public function getPasswordHasherName(): ?string
  801.     {
  802.         return null;
  803.     }
  804.     public function __call($name$arguments): void
  805.     {
  806.         // TODO: Implement @method string getUserIdentifier()
  807.     }
  808. }