Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace MC\CardBundle\Document;
- use Symfony\Component\Security\Core\User\UserInterface;
- use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
- /**
- * @MongoDB\Document(repositoryClass="MC\CardBundle\Repository\UserRepository", collection="users")
- */
- class User implements UserInterface
- {
- /**
- * @MongoDB\Id
- */
- protected $id;
- /**
- * @MongoDB\String
- */
- protected $uname;
- /**
- * Displayed name
- *
- * @MongoDB\String
- */
- protected $display;
- /**
- * Location
- *
- * @MongoDB\String
- */
- protected $loc;
- /**
- * Hashed password
- *
- * @MongoDB\String
- */
- protected $pwd;
- /**
- *
- * @MongoDB\Date
- */
- protected $bday;
- /**
- * Last visit date
- *
- * @MongoDB\Timestamp
- */
- protected $lvisit;
- /**
- * Register date
- *
- * @MongoDB\Timestamp
- */
- protected $rdate;
- public function getId()
- {
- return $this->id;
- }
- /**
- * Retrieve the user's locale, but provide a default
- * value if user has set nothing.
- *
- * @param string $default
- */
- public function getLocale($default = 'en')
- {
- return empty($this->loc) ? $default : $this->loc;
- }
- public function getUname()
- {
- return $this->uname;
- }
- public function getUsername()
- {
- return $this->getUname();
- }
- public function setUsername($uname)
- {
- $this->uname = $uname;
- }
- public function getDisplayname()
- {
- return $this->display;
- }
- public function setDisplayname($name)
- {
- $this->display = $name;
- }
- public function getPassword()
- {
- return $this->pwd;
- }
- public function setPassword($pwd)
- {
- $this->pwd = md5($pwd);
- }
- public function getRoles()
- {
- return array();
- }
- public function getSalt()
- {
- return "";
- }
- public function eraseCredentials()
- {
- // fixme
- }
- public function equals(UserInterface $user)
- {
- return $user->getId() === $this->getId();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement