Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Kaminski\UserBundle\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\Security\Core\User\AdvancedUserInterface as AdvancedUserInterface;
- /**
- * Kaminski\UserBundle\Entity\User
- *
- * @ORM\Table()
- * @ORM\Entity
- */
- class User implements AdvancedUserInterface
- {
- /**
- * @var integer $id
- *
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var string $username
- *
- * @ORM\Column(name="username", type="string", length=255, unique=true)
- */
- private $username;
- /**
- * @var string $email
- *
- * @ORM\Column(name="email", type="string", length=255)
- */
- private $email;
- /**
- * @var string $password
- *
- * @ORM\Column(name="password", type="string", length=999, nullable=true)
- */
- private $password;
- /**
- * @var string $salt
- *
- * @ORM\Column(name="salt", type="string", length=999)
- */
- private $salt;
- /**
- * @var boolean $accountNonExpired
- *
- * @ORM\Column(name="accountNonExpired", type="boolean")
- */
- private $accountNonExpired;
- /**
- * @var boolean $accountNonLocked
- *
- * @ORM\Column(name="accountNonLocked", type="boolean")
- */
- private $accountNonLocked;
- /**
- * @var boolean $enabled
- *
- * @ORM\Column(name="enabled", type="boolean")
- */
- private $enabled;
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set username
- *
- * @param string $username
- */
- public function setUsername($username)
- {
- $this->username = $username;
- }
- /**
- * Get username
- *
- * @return string
- */
- public function getUsername()
- {
- return $this->username;
- }
- /**
- * Set email
- *
- * @param string $email
- */
- public function setEmail($email)
- {
- $this->email = $email;
- }
- /**
- * Get email
- *
- * @return string
- */
- public function getEmail()
- {
- return $this->email;
- }
- /**
- * Set password
- *
- * @param string $password
- */
- public function setPassword($password)
- {
- $this->password = $password;
- }
- /**
- * Get password
- *
- * @return string
- */
- public function getPassword()
- {
- return $this->password;
- }
- /**
- * Set salt
- *
- * @param string $salt
- */
- public function setSalt($salt)
- {
- $this->salt = $salt;
- }
- /**
- * Get salt
- *
- * @return string
- */
- public function getSalt()
- {
- return $this->salt;
- }
- /**
- * {@inheritdoc}
- */
- function equals(UserInterface $user)
- {
- return true;
- }
- /**
- * {@inheritdoc}
- */
- public function eraseCredentials()
- {
- $this->password = null;
- return true;
- }
- /**
- * {@inheritdoc}
- */
- public function getRoles()
- {
- return array("ROLE_ADMIN");
- }
- /**
- * {@inheritdoc}
- */
- public function isAccountNonExpired()
- {
- return $this->accountNonExpired;
- }
- /**
- * {@inheritdoc}
- */
- public function isAccountNonLocked()
- {
- return $this->accountNonLocked;
- }
- /**
- * {@inheritdoc}
- */
- public function isCredentialsNonExpired()
- {
- if( is_null( $this->password) || !$this->password || strlen($this->password) < 1)
- {
- return false;
- }
- return true;
- }
- /**
- * {@inheritdoc}
- */
- public function isEnabled()
- {
- return $this->enabled;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement