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\Table(name="users")
- * @ORM\Entity
- */
- class User implements UserInterface, \Serializable
- {
- /**
- * @ORM\Column(type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @ORM\Column(type="string", length=25, unique=true)
- */
- private $username;
- /**
- * @ORM\Column(type="string", length=64)
- */
- private $password;
- /**
- * @ORM\Column(type="string", length=254, unique=true)
- */
- private $email;
- /**
- * @ORM\Column(name="is_active", type="boolean")
- */
- private $isActive;
- public function __construct()
- {
- $this->isActive = true;
- // may not be needed, see section on salt below
- // $this->salt = md5(uniqid('', true));
- }
- public function setUsername($username)
- {
- $this->username = $username;
- return $this;
- }
- public function getUsername()
- {
- return $this->username;
- }
- public function getSalt()
- {
- // you *may* need a real salt depending on your encoder
- // see section on salt below
- return null;
- }
- public function setPassword($password)
- {
- $this->password = $password;
- return $this;
- }
- public function getPassword()
- {
- return $this->password;
- }
- public function getRoles()
- {
- return array('ROLE_USER');
- }
- public function eraseCredentials()
- {
- }
- /** @see \Serializable::serialize() */
- public function serialize()
- {
- return serialize(array(
- $this->id,
- $this->username,
- $this->password,
- // see section on salt below
- // $this->salt,
- ));
- }
- /** @see \Serializable::unserialize() */
- public function unserialize($serialized)
- {
- list (
- $this->id,
- $this->username,
- $this->password,
- // see section on salt below
- // $this->salt
- ) = unserialize($serialized);
- }
- /**
- * @return mixed
- */
- public function getEmail()
- {
- return $this->email;
- }
- /**
- * @param mixed $email
- *
- * @return User
- */
- public function setEmail($email)
- {
- $this->email = $email;
- return $this;
- }
- /**
- * @return mixed
- */
- public function getIsActive()
- {
- return $this->isActive;
- }
- /**
- * @param mixed $isActive
- *
- * @return User
- */
- public function setIsActive($isActive)
- {
- $this->isActive = $isActive;
- return $this;
- }
- }
Add Comment
Please, Sign In to add comment