Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace My\HelloBundle\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\Security\Core\User\UserInterface;
- /**
- * My\HelloBundle\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=128)
- */
- private $username;
- /**
- * @var string $password
- *
- * @ORM\Column(name="password", type="string", length=128)
- */
- private $password;
- /**
- * @var string $first_name
- *
- * @ORM\Column(name="first_name", type="string", length=128)
- */
- private $first_name;
- /**
- * @var string $last_name
- *
- * @ORM\Column(name="last_name", type="string", length=128)
- */
- private $last_name;
- /**
- * @var string $email
- *
- * @ORM\Column(name="email", type="string", length=128)
- */
- private $email;
- /**
- * @var smallint $role
- *
- * @ORM\Column(name="role", type="string", length=128)
- */
- private $role;
- public function __construct()
- {
- $this->isActive = true;
- $this->salt = base_convert(sha1(uniqid(mt_rand(), true)), 16, 36);
- }
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- function save($obj){
- $em = $obj->getDoctrine()->getEntityManager();
- $em->persist($this);
- $em->flush();
- }
- function getRoles(){
- }
- function eraseCredentials(){
- }
- function equals(UserInterface $user){
- return ($user->getEmail() === $this->getEmail()) && ($user->getPassword() === $this->getPassword());
- }
- /**
- * Set last_name
- *
- * @param string $lastName
- */
- public function setLastName($lastName)
- {
- $this->last_name = $lastName;
- }
- /**
- * Get last_name
- *
- * @return string
- */
- public function getLastName()
- {
- return $this->last_name;
- }
- /**
- * 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 role
- *
- * @param smallint $role
- */
- public function setRole($role)
- {
- $this->role = $role;
- }
- /**
- * Get role
- *
- * @return smallint
- */
- public function getRole()
- {
- return $this->role;
- }
- /**
- * Set first_name
- *
- * @param string $firstName
- */
- public function setFirstName($firstName)
- {
- $this->first_name = $firstName;
- }
- /**
- * Get first_name
- *
- * @return string
- */
- public function getFirstName()
- {
- return $this->first_name;
- }
- /**
- * Set username
- *
- * @param string $username
- */
- public function setUsername($username)
- {
- $this->username = $username;
- }
- /**
- * Get username
- *
- * @return string
- */
- public function getUsername()
- {
- return $this->username;
- }
- /**
- * Set salt
- *
- * @param string $salt
- */
- public function setSalt($salt)
- {
- $this->salt = $salt;
- }
- function getSalt()
- {
- return $this->salt;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment