Advertisement
Guest User

UserInterface

a guest
Oct 21st, 2012
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.88 KB | None | 0 0
  1. <?php
  2.  
  3. namespace SeerUK\Security\AccountBundle\Entity;
  4.  
  5. use Symfony\Component\Security\Core\User\UserInterface;
  6. use Doctrine\ORM\Mapping as ORM;
  7.  
  8. /**
  9.  * SeerUK\Security\AccountBundle\Entity\User
  10.  *
  11.  * @ORM\Table(name="account")
  12.  * @ORM\Entity(repositoryClass="SeerUK\Security\AccountBundle\Entity\UserRepository")
  13.  */
  14. class User implements UserInterface
  15. {
  16.     /**
  17.      * @ORM\Column(type="integer")
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue(strategy="AUTO")
  20.      */
  21.     private $account_id;
  22.  
  23.     /**
  24.      * @ORM\Column(type="string", length=25, unique=true)
  25.      */
  26.     private $account_name;
  27.  
  28.     /**
  29.      * @ORM\Column(type="string", length=32)
  30.      */
  31.     private $account_salt;
  32.  
  33.     /**
  34.      * @ORM\Column(type="string", length=128)
  35.      */
  36.     private $account_password;
  37.  
  38.     /**
  39.      * @ORM\Column(type="string", length=255, unique=true)
  40.      */
  41.     private $account_email;
  42.  
  43.     /**
  44.      * @ORM\Column(name="is_active", type="boolean")
  45.      */
  46.     private $isActive;
  47.  
  48.     public function __construct()
  49.     {
  50.         $this->isActive = true;
  51.         $this->account_salt = ''; //md5(uniqid(null, true));
  52.     }
  53.  
  54.     /**
  55.      * @inheritDoc
  56.      */
  57.     public function getUsername()
  58.     {
  59.         return $this->account_name;
  60.     }
  61.  
  62.     /**
  63.      * @inheritDoc
  64.      */
  65.     public function getSalt()
  66.     {
  67.         return $this->account_salt;
  68.     }
  69.  
  70.     /**
  71.      * @inheritDoc
  72.      */
  73.     public function getPassword()
  74.     {
  75.         return $this->account_password;
  76.     }
  77.  
  78.     /**
  79.      * @inheritDoc
  80.      */
  81.     public function getRoles()
  82.     {
  83.         return array('ROLE_USER');
  84.     }
  85.  
  86.     /**
  87.      * @inheritDoc
  88.      */
  89.     public function eraseCredentials()
  90.     {
  91.     }
  92.  
  93.     /**
  94.      * @inheritDoc
  95.      */
  96.     public function equals(UserInterface $user)
  97.     {
  98.         return $this->account_name === $user->getUsername();
  99.     }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement