Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace F3\FFGBundle\Entity;
- use Symfony\Component\Security\Core\User\UserInterface;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * F3\FFGBundle\Entity\User
- *
- * @ORM\Table()
- * @ORM\Entity
- */
- class User implements UserInterface
- {
- /**
- * @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)
- */
- private $username;
- /**
- * @var string $password
- *
- * @ORM\Column(name="password", type="string", length=40)
- */
- private $password;
- /**
- * 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 password
- *
- * @param string $password
- */
- public function setPassword($password)
- {
- $this->password = $password;
- }
- /**
- * Get password
- *
- * @return string
- */
- public function getPassword()
- {
- return $this->password;
- }
- /********* CODE BELOW IS TO MAKE IT WORK AS AUTH CLASS **********/
- public function getRoles()
- {
- return array();
- }
- public function getSalt()
- {
- return null;
- }
- public function eraseCredentials() {}
- public function equals(UserInterface $user)
- {
- if (!$user instanceof User) {
- return false;
- }
- if ($this->password !== $user->getPassword()) {
- return false;
- }
- if ($this->getSalt() !== $user->getSalt()) {
- return false;
- }
- if ($this->username !== $user->getUsername()) {
- return false;
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement