Advertisement
Guest User

Untitled

a guest
Jun 27th, 2011
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.00 KB | None | 0 0
  1. <?php
  2.  
  3. namespace MC\CardBundle\Document;
  4.  
  5. use Symfony\Component\Security\Core\User\UserInterface;
  6. use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
  7.  
  8. /**
  9.  * @MongoDB\Document(repositoryClass="MC\CardBundle\Repository\UserRepository", collection="users")
  10.  */
  11. class User implements UserInterface
  12. {
  13.   /**
  14.    * @MongoDB\Id
  15.    */
  16.   protected $id;
  17.  
  18.   /**
  19.    * @MongoDB\String
  20.    */
  21.   protected $uname;
  22.  
  23.   /**
  24.    * Displayed name
  25.    *
  26.    * @MongoDB\String
  27.    */
  28.   protected $display;
  29.  
  30.   /**
  31.    * Location
  32.    *
  33.    * @MongoDB\String
  34.    */
  35.   protected $loc;
  36.  
  37.   /**
  38.    * Hashed password
  39.    *
  40.    * @MongoDB\String
  41.    */
  42.   protected $pwd;
  43.  
  44.   /**
  45.    *
  46.    * @MongoDB\Date
  47.    */
  48.   protected $bday;
  49.  
  50.   /**
  51.    * Last visit date
  52.    *
  53.    * @MongoDB\Timestamp
  54.    */
  55.   protected $lvisit;
  56.  
  57.   /**
  58.    * Register date
  59.    *
  60.    * @MongoDB\Timestamp
  61.    */
  62.   protected $rdate;
  63.  
  64.   public function getId()
  65.   {
  66.     return $this->id;
  67.   }
  68.  
  69.   /**
  70.    * Retrieve the user's locale, but provide a default
  71.    * value if user has set nothing.
  72.    *
  73.    * @param string $default
  74.    */
  75.   public function getLocale($default = 'en')
  76.   {
  77.     return empty($this->loc) ? $default : $this->loc;
  78.   }
  79.  
  80.   public function getUname()
  81.   {
  82.     return $this->uname;
  83.   }
  84.  
  85.   public function getUsername()
  86.   {
  87.     return $this->getUname();
  88.   }
  89.  
  90.   public function setUsername($uname)
  91.   {
  92.     $this->uname = $uname;
  93.   }
  94.  
  95.   public function getDisplayname()
  96.   {
  97.     return $this->display;
  98.   }
  99.  
  100.   public function setDisplayname($name)
  101.   {
  102.     $this->display = $name;
  103.   }
  104.  
  105.   public function getPassword()
  106.   {
  107.     return $this->pwd;
  108.   }
  109.  
  110.   public function setPassword($pwd)
  111.   {
  112.     $this->pwd = md5($pwd);
  113.   }
  114.  
  115.   public function getRoles()
  116.   {
  117.     return array();
  118.   }
  119.  
  120.   public function getSalt()
  121.   {
  122.     return "";
  123.   }
  124.  
  125.   public function eraseCredentials()
  126.   {
  127.     // fixme
  128.   }
  129.  
  130.   public function equals(UserInterface $user)
  131.   {
  132.     return $user->getId() === $this->getId();
  133.   }
  134. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement