Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Created by IntelliJ IDEA.
- * Copyright (c) 2008-2011, Kostadin Mehomiyski
- * All rights reserved.
- *
- * Author: Kostadin Mehomiyski
- * E-mail: kostadin.mehomiyski@gmail.com
- * License: <license>
- * Description: <description>
- *
- * Created: 4/3/11 @ 11:28 PM EET
- */
- namespace SyntheticMinds\WebBundle\Entity;
- use Symfony\Component\Security\Core\User\UserInterface;
- /** @orm:Entity @orm:Table(name="users") */
- class User implements UserInterface {
- /** @orm:Id @orm:Column(type="integer") @orm:GeneratedValue(strategy="AUTO") */
- protected $id;
- /** @orm:Column(type="string", length=50, unique=true, nullable=false) */
- protected $username;
- /** @orm:Column(type="string", length=40, nullable=false) */
- protected $password;
- /** @orm:Column(type="string", length=40, nullable=false) */
- protected $salt;
- /** @orm:Column(type="string", length=40, nullable=false) */
- protected $role;
- public function setPassword($password) {
- $this->password = $password;
- }
- public function setSalt($salt) {
- $this->salt = $salt;
- }
- /**
- * The equality comparison should neither be done by referential equality
- * nor by comparing identities (i.e. getId() === getId()).
- *
- * However, you do not need to compare every attribute, but only those that
- * are relevant for assessing whether re-authentication is required.
- *
- * @param UserInterface $user
- * @return Boolean
- */
- public function equals(UserInterface $user) {
- if ($this->username == $user->getUsername() && $this->salt == $user->getSalt())
- return true;
- else
- return false;
- }
- /**
- * Removes sensitive data from the user.
- *
- * @return void
- */
- public function eraseCredentials() {
- // TODO: Implement eraseCredentials() method.
- }
- /**
- * Returns the password used to authenticate the user.
- *
- * @return string The password
- */
- public function getPassword() {
- return $this->password;
- }
- /**
- * Returns the roles granted to the user.
- *
- * @return Role[] The user roles
- */
- public function getRoles() {
- return $this->role;
- }
- /**
- * Returns the salt.
- *
- * @return string The salt
- */
- public function getSalt() {
- return $this->salt;
- }
- /**
- * Returns the username used to authenticate the user.
- *
- * @return string The username
- */
- public function getUsername() {
- $this->username;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement