Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\Security\Core\User\UserInterface;
- /**
- * @ORM\Entity(repositoryClass="App\Repository\UserRepository")
- */
- class User implements UserInterface, \Serializable
- {
- /**
- * @ORM\Id()
- * @ORM\GeneratedValue()
- * @ORM\Column(type="integer")
- */
- private $id;
- /**
- * @ORM\Column(type="string", length=255)
- */
- private $username;
- /**
- * @ORM\Column(type="string", length=255)
- */
- private $email;
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- */
- private $password;
- /**
- * @ORM\Column(type="text", nullable=true)
- */
- private $address;
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getUsername(): ?string
- {
- return $this->username;
- }
- public function setUsername(string $username): self
- {
- $this->username = $username;
- return $this;
- }
- public function getEmail(): ?string
- {
- return $this->email;
- }
- public function setEmail(string $email): self
- {
- $this->email = $email;
- return $this;
- }
- public function getPassword(): ?string
- {
- return $this->password;
- }
- public function setPassword(?string $password): self
- {
- $this->password = $password;
- return $this;
- }
- public function getAddress(): ?string
- {
- return $this->address;
- }
- public function setAddress(?string $address): self
- {
- $this->address = $address;
- return $this;
- }
- public function __toString()
- {
- return $this->getUsername();
- }
- /** @see \Serializable::serialize() */
- public function serialize()
- {
- return serialize(array(
- $this->id,
- $this->email,
- $this->username,
- $this->password,
- // see section on salt below
- // $this->salt,
- ));
- }
- /** @see \Serializable::unserialize() */
- public function unserialize($serialized)
- {
- list (
- $this->id,
- $this->email,
- $this->username,
- $this->password,
- // see section on salt below
- // $this->salt
- ) = unserialize($serialized, array('allowed_classes' => false));
- }
- public function getSalt()
- {
- // you *may* need a real salt depending on your encoder
- // see section on salt below
- return null;
- }
- public function getRoles()
- {
- return array('ROLE_USER');
- }
- public function eraseCredentials()
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment