Advertisement
Puzo

Error UserInterFace - Users.php

May 23rd, 2012
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.15 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\AdminBundle\Entity;
  4.  
  5. use Symfony\Component\Security\Core\User\UserInterface;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use DateTime as DateTime;
  8.  
  9. use Doctrine\ORM\Mapping as ORM;
  10.  
  11. /**
  12.  * App\AdminBundle\Entity\Users
  13.  */
  14. class Users implements UserInterface
  15. {
  16.     /**
  17.      * @var integer $id
  18.      */
  19.     private $id;
  20.  
  21.     /**
  22.      * @var string $name
  23.      */
  24.     private $name;
  25.  
  26.     /**
  27.      * @var string $password
  28.      */
  29.     private $password;
  30.  
  31.     /**
  32.      * @var string $salt
  33.      */
  34.     private $salt;
  35.  
  36.     /**
  37.      * @var string $username
  38.      */
  39.     private $username;
  40.  
  41.     /**
  42.      * @var datetime $cdate
  43.      */
  44.     private $cdate;
  45.  
  46.     /**
  47.      * @var datetime $mdate
  48.      */
  49.     private $mdate;
  50.  
  51.     /**
  52.      * @var App\AdminBundle\Entity\Roles
  53.      */
  54.     private $role;
  55.  
  56.     public function __construct()
  57.     {
  58.         $this->role = new \Doctrine\Common\Collections\ArrayCollection();
  59.         $this->cdate = new \DateTime();
  60.         $this->mdate = new \DateTime();
  61.     }
  62.    
  63.     /**
  64.      * Get id
  65.      *
  66.      * @return integer
  67.      */
  68.     public function getId()
  69.     {
  70.         return $this->id;
  71.     }
  72.  
  73.     /**
  74.      * Set name
  75.      *
  76.      * @param string $name
  77.      */
  78.     public function setName($name)
  79.     {
  80.         $this->name = $name;
  81.     }
  82.  
  83.     /**
  84.      * Get name
  85.      *
  86.      * @return string
  87.      */
  88.     public function getName()
  89.     {
  90.         return $this->name;
  91.     }
  92.  
  93.     /**
  94.      * Set password
  95.      *
  96.      * @param string $password
  97.      */
  98.     public function setPassword($password)
  99.     {
  100.         $this->password = $password;
  101.     }
  102.  
  103.     /**
  104.      * Get password
  105.      *
  106.      * @return string
  107.      */
  108.     public function getPassword()
  109.     {
  110.         return $this->password;
  111.     }
  112.  
  113.     /**
  114.      * Set salt
  115.      *
  116.      * @param string $salt
  117.      */
  118.     public function setSalt($salt)
  119.     {
  120.         $this->salt = $salt;
  121.     }
  122.  
  123.     /**
  124.      * Get salt
  125.      *
  126.      * @return string
  127.      */
  128.     public function getSalt()
  129.     {
  130.         return $this->salt;
  131.     }
  132.  
  133.     /**
  134.      * Set username
  135.      *
  136.      * @param string $username
  137.      */
  138.     public function setUsername($username)
  139.     {
  140.         $this->username = $username;
  141.     }
  142.  
  143.     /**
  144.      * Get username
  145.      *
  146.      * @return string
  147.      */
  148.     public function getUsername()
  149.     {
  150.         return $this->username;
  151.     }
  152.  
  153.     /**
  154.      * Set cdate
  155.      *
  156.      * @param datetime $cdate
  157.      */
  158.     public function setCdate($cdate)
  159.     {
  160.         $this->cdate = $cdate;
  161.     }
  162.  
  163.     /**
  164.      * Get cdate
  165.      *
  166.      * @return datetime
  167.      */
  168.     public function getCdate()
  169.     {
  170.         return $this->cdate;
  171.     }
  172.  
  173.     /**
  174.      * Set mdate
  175.      *
  176.      * @param datetime $mdate
  177.      */
  178.     public function setMdate($mdate)
  179.     {
  180.         $this->mdate = $mdate;
  181.     }
  182.  
  183.     /**
  184.      * Get mdate
  185.      *
  186.      * @return datetime
  187.      */
  188.     public function getMdate()
  189.     {
  190.         return $this->mdate;
  191.     }
  192.  
  193.     /**
  194.      * Add role
  195.      *
  196.      * @param App\AdminBundle\Entity\Roles $role
  197.      */
  198.     public function addRoles(\App\AdminBundle\Entity\Roles $role)
  199.     {
  200.         $this->role[] = $role;
  201.     }
  202.  
  203.     /**
  204.      * Get role
  205.      *
  206.      * @return Doctrine\Common\Collections\Collection
  207.      */
  208.     public function getRole()
  209.     {
  210.         return $this->role;
  211.     }
  212.    
  213.     /**
  214.      * Get user roles
  215.      */
  216.     public function getUserRoles()
  217.     {
  218.         return $this->getRole();
  219.     }
  220.    
  221.     /**
  222.      * Get roles
  223.      *
  224.      * @return Array
  225.      */
  226.     public function getRoles()
  227.     {
  228.         return $this->getUserRoles()->toArray();
  229.     }
  230.    
  231.     /**
  232.      * Erases the user credentials.
  233.      */
  234.     public function eraseCredentials()
  235.     {
  236.    
  237.     }
  238.    
  239.     /**
  240.      * Compares this user to another to determine if they are the same.
  241.      *
  242.      * @param UserInterface $user The user
  243.      * @return boolean True if equal, false othwerwise.
  244.      */
  245.     public function equals(UserInterface $user)
  246.     {
  247.         if( $user->getUsername() != $this->getUsername() )
  248.             return false;
  249.         return true;
  250.     }
  251. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement