Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\AdminBundle\Entity;
- use Symfony\Component\Security\Core\User\UserInterface;
- use Doctrine\Common\Collections\ArrayCollection;
- use DateTime as DateTime;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * App\AdminBundle\Entity\Users
- */
- class Users implements UserInterface
- {
- /**
- * @var integer $id
- */
- private $id;
- /**
- * @var string $name
- */
- private $name;
- /**
- * @var string $password
- */
- private $password;
- /**
- * @var string $salt
- */
- private $salt;
- /**
- * @var string $username
- */
- private $username;
- /**
- * @var datetime $cdate
- */
- private $cdate;
- /**
- * @var datetime $mdate
- */
- private $mdate;
- /**
- * @var App\AdminBundle\Entity\Roles
- */
- private $role;
- public function __construct()
- {
- $this->role = new \Doctrine\Common\Collections\ArrayCollection();
- $this->cdate = new \DateTime();
- $this->mdate = new \DateTime();
- }
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set name
- *
- * @param string $name
- */
- public function setName($name)
- {
- $this->name = $name;
- }
- /**
- * Get name
- *
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * Set password
- *
- * @param string $password
- */
- public function setPassword($password)
- {
- $this->password = $password;
- }
- /**
- * Get password
- *
- * @return string
- */
- public function getPassword()
- {
- return $this->password;
- }
- /**
- * Set salt
- *
- * @param string $salt
- */
- public function setSalt($salt)
- {
- $this->salt = $salt;
- }
- /**
- * Get salt
- *
- * @return string
- */
- public function getSalt()
- {
- return $this->salt;
- }
- /**
- * Set username
- *
- * @param string $username
- */
- public function setUsername($username)
- {
- $this->username = $username;
- }
- /**
- * Get username
- *
- * @return string
- */
- public function getUsername()
- {
- return $this->username;
- }
- /**
- * Set cdate
- *
- * @param datetime $cdate
- */
- public function setCdate($cdate)
- {
- $this->cdate = $cdate;
- }
- /**
- * Get cdate
- *
- * @return datetime
- */
- public function getCdate()
- {
- return $this->cdate;
- }
- /**
- * Set mdate
- *
- * @param datetime $mdate
- */
- public function setMdate($mdate)
- {
- $this->mdate = $mdate;
- }
- /**
- * Get mdate
- *
- * @return datetime
- */
- public function getMdate()
- {
- return $this->mdate;
- }
- /**
- * Add role
- *
- * @param App\AdminBundle\Entity\Roles $role
- */
- public function addRoles(\App\AdminBundle\Entity\Roles $role)
- {
- $this->role[] = $role;
- }
- /**
- * Get role
- *
- * @return Doctrine\Common\Collections\Collection
- */
- public function getRole()
- {
- return $this->role;
- }
- /**
- * Get user roles
- */
- public function getUserRoles()
- {
- return $this->getRole();
- }
- /**
- * Get roles
- *
- * @return Array
- */
- public function getRoles()
- {
- return $this->getUserRoles()->toArray();
- }
- /**
- * Erases the user credentials.
- */
- public function eraseCredentials()
- {
- }
- /**
- * Compares this user to another to determine if they are the same.
- *
- * @param UserInterface $user The user
- * @return boolean True if equal, false othwerwise.
- */
- public function equals(UserInterface $user)
- {
- if( $user->getUsername() != $this->getUsername() )
- return false;
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement