src/Entity/Users.php line 27
<?phpnamespace App\Entity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Security\Core\User\UserInterface;use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;use OlaSoft\Common;use App\Repository\UsersRepository;/*** @ORM\Entity(repositoryClass="App\Repository\UsersRepository")* @UniqueEntity(fields="email", message="Un utilisateur existe déjà avec ce compte email.")* @ORM\AttributeOverrides({* @ORM\AttributeOverride(name="email",* column=@ORM\Column(* name = "email",* length = 191,* unique = true* )* )* })*/class Users implements UserInterface, PasswordAuthenticatedUserInterface{private $em;public function __construct(){$this->createdAt = new \DateTime;$this->isEnabled = false;$this->profiles = new ArrayCollection();}/*** @ORM\Column(name="id", type="integer")* @ORM\Id* @ORM\GeneratedValue(strategy="AUTO")*/private $id;/*** @ORM\Column(name="fName", type="string", length=255, nullable=true)*/private $fName;/*** @ORM\Column(name="lName", type="string", length=255, nullable=true)*/private $lName;/*** @var string** @ORM\Column(name="phone", type="string", length=255, nullable=true)*/private $phone;/*** @ORM\Column(name="email", type="string", length=255, unique=true)*/private $email;/*** @ORM\Column(name="createdAt", type="datetime",nullable=true))*/private $createdAt;/*** @ORM\Column(name="lastLogin", type="datetime",nullable=true))*/private $lastLogin;/*** @var string The hashed password** @ORM\Column(name="password", type="string", length=255,nullable=true))*/private $password;/*** @ORM\Column(name="token", type="string", length=255, nullable=true))*/private $token;/*** @ORM\Column(name="sex", type="boolean", nullable=true)*/private $sex;/*** @ORM\Column(name="isEnabled", type="boolean", nullable=true)*/private $isEnabled;/*** @ORM\ManyToOne(targetEntity="App\Entity\Profiles", inversedBy="users")*/private $profile;public function eraseCredentials() {}/*** The public representation of the user (e.g. a username, an email address, etc.)** @see UserInterface*/public function getUserIdentifier(): string{return (string) $this->email;}/*** @see UserInterface*/public function getRoles(): array{// $roles[] = $this->profile ? $this->profile->getRole() : 'ROLE_USER';$roles = $this->profile ? [$this->profile->getRole()] : ['ROLE_USER'];return array_unique($roles);}public function getSalt() {$salt = '';return null;}public function getUsername() {return $this->email;}/*** @see PasswordAuthenticatedUserInterface*/public function getPassword(): ?string{return $this->password;}// public function serialize()// {// return serialize(array(// $this->id,// $this->email,// $this->password,// ));// }// public function unserialize($serialized)// {// list (// $this->id,// $this->email,// $this->password,// ) = unserialize($serialized, array('allowed_classes' => false));// }public function getId(): ?int{return $this->id;}public function getFName(): ?string{return $this->fName;}public function setFName(?string $fName): self{$this->fName = $fName;return $this;}public function getLName(): ?string{return $this->lName;}public function setLName(?string $lName): self{$this->lName = $lName;return $this;}public function getName(): ?string{return $this->lName.' '.$this->fName;}public function getPhone(): ?string{return $this->phone;}public function setPhone(?string $phone): self{$this->phone = $phone;return $this;}public function getCreatedAt(): ?\DateTimeInterface{return $this->createdAt;}public function setCreatedAt(?\DateTimeInterface $createdAt): self{$this->createdAt = $createdAt;return $this;}public function getLastLogin(): ?\DateTimeInterface{return $this->lastLogin;}public function setLastLogin(?\DateTimeInterface $lastLogin): self{$this->lastLogin = $lastLogin;return $this;}public function setPassword(?string $password = null): self{$this->password = $password ? password_hash($password, PASSWORD_BCRYPT, array('cost' => 12)) : null;return $this;}public function getToken(): ?string{return $this->token;}public function setToken(?string $token): self{$this->token = $token;return $this;}public function getSex(): ?bool{return $this->sex;}public function setSex(?bool $sex): self{$this->sex = $sex;return $this;}public function getIsEnabled(): ?bool{return $this->isEnabled;}public function setIsEnabled(?bool $isEnabled): self{$this->isEnabled = $isEnabled;return $this;}public function getEmail(): ?string{return $this->email;}public function setEmail(string $email): self{$this->email = $email;return $this;}public function getProfile(): ?Profiles{return $this->profile;}public function setProfile(?Profiles $profile): self{$this->profile = $profile;return $this;}public function __toString(){return $this->fName." ".$this->lName;}}