Advertisement
ascott

Entity-EngineRoles

Aug 31st, 2012
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.64 KB | None | 0 0
  1. <?php
  2.  
  3. namespace RedK\Core\IndexBundle\Entity;
  4.  
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Symfony\Component\Security\Core\Role\RoleInterface;
  8.  
  9. /**
  10.  * RedK\Core\IndexBundle\Entity\EngineRoles
  11.  *
  12.  * @ORM\Table(name="engine_roles")
  13.  * @ORM\Entity
  14.  */
  15. class EngineRoles implements RoleInterface
  16. {
  17.     /**
  18.      * @var integer $id
  19.      *
  20.      * @ORM\Column(name="id", type="integer", nullable=false)
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue(strategy="IDENTITY")
  23.      */
  24.     protected $id;
  25.  
  26.     /**
  27.      * @var string $role
  28.      *
  29.      * @ORM\Column(name="role", type="string", length=255, nullable=false, unique=true)
  30.      */
  31.     protected $role;
  32.  
  33.     /**
  34.      * @ORM\ManyToMany(targetEntity="Accounts", mappedBy="roles")
  35.      * @ORM\JoinTable(name="accounts_groups",
  36.      *     joinColumns={@ORM\JoinColumn(name="account_fk", referencedColumnName="id")},
  37.      *     inverseJoinColumns={@ORM\JoinColumn(name="role_fk", referencedColumnName="role")}
  38.      *     )
  39.      */
  40.     protected $accounts;
  41.  
  42.  
  43.     public function __construct()
  44.     {
  45.         $this->accounts = new ArrayCollection();
  46.     }
  47.  
  48.     /**
  49.      * Get id
  50.      *
  51.      * @return integer
  52.      */
  53.     public function getId()
  54.     {
  55.         return $this->id;
  56.     }
  57.  
  58.     /**
  59.      * Set role
  60.      *
  61.      * @param string $role
  62.      * @return EngineRoles
  63.      */
  64.     public function setRole($role)
  65.     {
  66.         $this->role = $role;
  67.  
  68.         return $this;
  69.     }
  70.  
  71.     /**
  72.      * Get role
  73.      * @see RoleInterface
  74.      * @return string
  75.      */
  76.     public function getRole()
  77.     {
  78.         return $this->role;
  79.     }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement