Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // src/AppBundle/Entity/User.php
- namespace AndroneBundle\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\Security\Core\User\UserInterface;
- /**
- * @ORM\Entity
- * @ORM\Table(name="users")
- */
- 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(name="is_active", type="boolean")
- */
- private $isActive;
- /**
- * @ORM\Column(name="android_version", type="integer")
- */
- private $androidVersion;
- /**
- * @ORM\Column(type="string", columnDefinition="ENUM('ROLE_ADMIN', 'ROLE_USER', 'ROLE_SUPER')")
- */
- private $role;
- public function __construct()
- {
- $this->isActive = true;
- // may not be needed, see section on salt below
- // $this->salt = md5(uniqid(null, true));
- }
- 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 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);
- }
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set username
- *
- * @param string $username
- *
- * @return User
- */
- public function setUsername($username)
- {
- $this->username = $username;
- return $this;
- }
- /**
- * Set password
- *
- * @param string $password
- *
- * @return User
- */
- public function setPassword($password)
- {
- $this->password = $password;
- return $this;
- }
- /**
- * Set isActive
- *
- * @param boolean $isActive
- *
- * @return User
- */
- public function setIsActive($isActive)
- {
- $this->isActive = $isActive;
- return $this;
- }
- /**
- * Get isActive
- *
- * @return boolean
- */
- public function getIsActive()
- {
- return $this->isActive;
- }
- /**
- * Set androidVersion
- *
- * @param integer $androidVersion
- *
- * @return User
- */
- public function setAndroidVersion($androidVersion)
- {
- $this->androidVersion = $androidVersion;
- return $this;
- }
- /**
- * Get androidVersion
- *
- * @return integer
- */
- public function getAndroidVersion()
- {
- return $this->androidVersion;
- }
- /**
- * Set role
- *
- * @param string $role
- *
- * @return User
- */
- public function setRole($role)
- {
- $this->role = $role;
- return $this;
- }
- /**
- * Get role
- *
- * @return string
- */
- public function getRole()
- {
- return $this->role;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement