3 namespace Wallabag\CoreBundle\Entity
;
5 use Doctrine\ORM\Mapping
as ORM
;
6 use Symfony\Component\Security\Core\User\UserInterface
;
7 use Symfony\Component\Security\Core\User\AdvancedUserInterface
;
12 * @ORM\Table(name="users")
15 class Users
implements AdvancedUserInterface
, \Serializable
20 * @ORM\Column(name="id", type="integer", nullable=true)
22 * @ORM\GeneratedValue(strategy="IDENTITY")
29 * @ORM\Column(name="username", type="text", nullable=true)
34 * @ORM\Column(type="string", length=32)
41 * @ORM\Column(name="password", type="text", nullable=true)
48 * @ORM\Column(name="name", type="text", nullable=true)
55 * @ORM\Column(name="email", type="text", nullable=true)
60 * @ORM\Column(name="is_active", type="boolean")
64 public function __construct()
66 $this->isActive
= true;
67 $this->salt
= md5(uniqid(null, true));
75 public function getId()
83 * @param string $username
86 public function setUsername($username)
88 $this->username
= $username;
98 public function getUsername()
100 return $this->username
;
106 public function getSalt()
114 public function getRoles()
116 return array('ROLE_USER');
122 * @param string $password
125 public function setPassword($password)
127 $this->password
= $password;
137 public function getPassword()
139 return $this->password
;
145 * @param string $name
148 public function setName($name)
160 public function getName()
168 * @param string $email
171 public function setEmail($email)
173 $this->email
= $email;
183 public function getEmail()
191 public function eraseCredentials()
196 * @see \Serializable::serialize()
198 public function serialize()
200 return serialize(array(
206 * @see \Serializable::unserialize()
208 public function unserialize($serialized)
212 ) = unserialize($serialized);
215 public function isEqualTo(UserInterface
$user)
217 return $this->username
=== $user->getUsername();
220 public function isAccountNonExpired()
225 public function isAccountNonLocked()
230 public function isCredentialsNonExpired()
235 public function isEnabled()
237 return $this->isActive
;