src/Entity/User.php line 22
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use App\Repository\UserRepository;use App\State\UserProcessor;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;use Symfony\Component\Security\Core\User\UserInterface;use Gedmo\Mapping\Annotation as Gedmo;use Vich\UploaderBundle\Mapping\Annotation as Vich;#[ORM\Entity(repositoryClass: UserRepository::class)]#[ApiResource(processor: UserProcessor::class)]#[Vich\Uploadable]class User implements UserInterface, PasswordAuthenticatedUserInterface{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 180, unique: true)]private ?string $email = null;#[ORM\Column]private array $roles = [];/*** @var string The hashed password*/#[ORM\Column]private ?string $password = null;private ?string $plainPassword = null;#[ORM\Column(length: 255, nullable: true)]private ?string $nom = null;#[ORM\Column(length: 255, nullable: true)]private ?string $prenom = null;#[ORM\Column(length: 255, nullable: true)]private ?string $telephone = null;#[ORM\Column(options: ['default' => false])]private ?bool $locked = false;#[ORM\Column(length: 255, nullable: true)]private ?string $telMobile = null;#[ORM\Column]#[Gedmo\Timestampable(on: 'create')]private ?\DateTimeImmutable $createdAt = null;#[ORM\Column]#[Gedmo\Timestampable(on: 'update')]private ?\DateTimeImmutable $updatedAt = null;#[ORM\ManyToOne(cascade: ['persist'])]private ?MediaObject $photoProfil = null;#[ORM\ManyToMany(targetEntity: Structure::class, inversedBy: 'users')]private Collection $structures;#[ORM\ManyToOne]private ?Structure $selectedStructure = null;#[ORM\OneToMany(mappedBy: 'user', targetEntity: Journal::class)]private Collection $journals;public function __construct(){$this->structures = new ArrayCollection();$this->journals = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getEmail(): ?string{return $this->email;}public function setEmail(string $email): static{$this->email = $email;return $this;}/*** A visual identifier that represents this user.** @see UserInterface*/public function getUserIdentifier(): string{return (string) $this->email;}/*** @see UserInterface*/public function getRoles(): array{$roles = $this->roles;// guarantee every user at least has ROLE_USER// $roles[] = 'ROLE_USER';return array_unique($roles);}public function setRoles(array $roles): static{$this->roles = $roles;return $this;}/*** @see PasswordAuthenticatedUserInterface*/public function getPassword(): string{return $this->password;}public function setPassword(string $password): static{$this->password = $password;return $this;}/*** @see UserInterface*/public function eraseCredentials(): void{// If you store any temporary, sensitive data on the user, clear it here// $this->plainPassword = null;}public function getNom(): ?string{return $this->nom;}public function setNom(?string $nom): static{$this->nom = $nom;return $this;}public function getPrenom(): ?string{return $this->prenom;}public function setPrenom(?string $prenom): static{$this->prenom = $prenom;return $this;}public function getTelephone(): ?string{return $this->telephone;}public function setTelephone(?string $telephone): static{$this->telephone = $telephone;return $this;}public function isLocked(): ?bool{return $this->locked;}public function setLocked(bool $locked): static{$this->locked = $locked;return $this;}public function getTelMobile(): ?string{return $this->telMobile;}public function setTelMobile(?string $telMobile): static{$this->telMobile = $telMobile;return $this;}public function getDisplayName (): string{return implode(' ', array_filter([ucfirst(strtolower($this->getPrenom())), strtoupper($this->getNom())]));}public function getCreatedAt(): ?\DateTimeImmutable{return $this->createdAt;}public function setCreatedAt(\DateTimeImmutable $createdAt): static{$this->createdAt = $createdAt;return $this;}public function getUpdatedAt(): ?\DateTimeImmutable{return $this->updatedAt;}public function setUpdatedAt(\DateTimeImmutable $updatedAt): static{$this->updatedAt = $updatedAt;return $this;}public function getPhotoProfil(): ?MediaObject{return $this->photoProfil;}public function setPhotoProfil(?MediaObject $photoProfil): static{$this->photoProfil = $photoProfil;return $this;}/*** @return string|null*/public function getPlainPassword(): ?string{return $this->plainPassword;}/*** @param string|null $plainPassword*/public function setPlainPassword(?string $plainPassword): void{$this->plainPassword = $plainPassword;}/*** @return Collection<int, Structure>*/public function getStructures(): Collection{return $this->structures;}public function addStructure(Structure $structure): static{if (!$this->structures->contains($structure)) {$this->structures->add($structure);}return $this;}public function removeStructure(Structure $structure): static{$this->structures->removeElement($structure);return $this;}public function getSelectedStructure(): ?Structure{return $this->selectedStructure;}public function setSelectedStructure(?Structure $selectedStructure): static{$this->selectedStructure = $selectedStructure;return $this;}/*** @return Collection<int, Journal>*/public function getJournals(): Collection{return $this->journals;}public function addJournal(Journal $journal): static{if (!$this->journals->contains($journal)) {$this->journals->add($journal);$journal->setUser($this);}return $this;}public function removeJournal(Journal $journal): static{if ($this->journals->removeElement($journal)) {// set the owning side to null (unless already changed)if ($journal->getUser() === $this) {$journal->setUser(null);}}return $this;}public function isMulti (): bool{return $this->getSelectedStructure()->isMulti();}}