Skip to content

Instantly share code, notes, and snippets.

@jmoz
Created December 2, 2011 15:48
Show Gist options
  • Select an option

  • Save jmoz/1423700 to your computer and use it in GitHub Desktop.

Select an option

Save jmoz/1423700 to your computer and use it in GitHub Desktop.
Role
<?php
namespace JMOZ\Bundle\SecurityBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\Role\RoleInterface;
/**
* Role Entity
*
* @ORM\Entity
* @ORM\Table( name="security_roles" )
*
* @author James Morris <james@jmoz.co.uk>
* @package SecurityBundle
*/
class Role implements RoleInterface
{
/**
* @ORM\Id
* @ORM\Column(type="integer", name="id")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", name="role", unique="true", length="70")
*/
private $role;
/**
* Populate the role field
* @param string $role ROLE_FOO etc
*/
public function __construct( $role )
{
$this->role = $role;
}
/**
* Return the role field.
* @return string
*/
public function getRole()
{
return $this->role;
}
/**
* Return the role field.
* @return string
*/
public function __toString()
{
return (string) $this->role;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment