Created
December 2, 2011 15:48
-
-
Save jmoz/1423700 to your computer and use it in GitHub Desktop.
Role
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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