Guest User

Untitled

a guest
Jul 19th, 2012
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.70 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. /**
  5.  * @ORM\Entity
  6.  * @ORM\Table(name="xxxx_roles")
  7.  */
  8. class Role implements RoleInterface
  9. {
  10.    
  11.    
  12.  
  13.     /**
  14.     * @ORM\Id
  15.     * @ORM\Column(type="integer")
  16.     * @ORM\GeneratedValue(strategy="AUTO")
  17.     */
  18.     protected $id;
  19.    
  20.    
  21.    
  22.     /**
  23.      * @ORM\Column(type="string", length="255", unique=true, nullable=false)
  24.      * @Assert\NotBlank(message="Please enter your Group.")
  25.      * @Assert\MinLength(limit="3", message="The name is too short.")
  26.      * @Assert\MaxLength(limit="255", message="The name is too long.")
  27.      */
  28.     protected $role;
  29.    
  30.    
  31.     /**
  32.      * Inverse Side
  33.      *
  34.      * @ORM\ManyToMany(targetEntity="Group", mappedBy="roles")
  35.      */
  36.     protected $groups;
  37.    
  38.    
  39.    
  40.     /**
  41.      * Get id
  42.      *
  43.      * @return integer
  44.      */
  45.     public function getId()
  46.     {
  47.         return $this->id;
  48.     }
  49.  
  50.     /**
  51.      * Populate the role field
  52.      * @param string $role ROLE_FOO etc
  53.      */
  54.     public function __construct( $role )
  55.     {
  56.         $this->role = $role;
  57.     }
  58.    
  59.     /**
  60.      * Return the role field.
  61.      * @return string
  62.      */
  63.     public function getRole()
  64.     {
  65.         return $this->role;
  66.     }
  67.    
  68.     /**
  69.      * Return the role field.
  70.      * @return string
  71.      */
  72.     public function __toString()
  73.     {
  74.         return (string) $this->role;
  75.     }
  76.  
  77.     /**
  78.      * Add groups
  79.      *
  80.      * @param xxxxx\UserBundle\Entity\Groups $groups
  81.      */
  82.     public function addGroups(\xxxxx\UserBundle\Entity\Groups $groups)
  83.     {
  84.         $this->groups[] = $groups;
  85.     }
  86.  
  87.     /**
  88.      * Get groups
  89.      *
  90.      * @return Doctrine\Common\Collections\Collection
  91.      */
  92.     public function getGroups()
  93.     {
  94.         return $this->groups;
  95.     }
  96.    
  97.    
  98.    
  99.    
  100. }
Advertisement
Add Comment
Please, Sign In to add comment