Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // src/Acme/Bundle/AccountBundle/Entity/Role.php
- namespace Acme\AccountBundle\Entity;
- use Symfony\Component\Security\Core\Role\RoleInterface;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * @ORM\Table(name="acme_roles")
- * @ORM\Entity()
- */
- class Role implements RoleInterface
- {
- /**
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id()
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @ORM\Column(name="name", type="string", length=30)
- */
- private $name;
- /**
- * @ORM\Column(name="role", type="string", length=20, unique=true)
- */
- private $role;
- /**
- * @ORM\ManyToMany(targetEntity="UserRole", mappedBy="roles")
- */
- private $users;
- public function __construct()
- {
- $this->users = new ArrayCollection();
- }
- /**
- * @see RoleInterface
- */
- public function getRole()
- {
- return $this->role;
- }
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set name
- *
- * @param string $name
- * @return Role
- */
- public function setName($name)
- {
- $this->name = $name;
- return $this;
- }
- /**
- * Get name
- *
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * Set role
- *
- * @param string $role
- * @return Role
- */
- public function setRole($role)
- {
- $this->role = $role;
- return $this;
- }
- /**
- * Add users
- *
- * @param \Acme\UserBundle\Entity\User $users
- * @return Role
- */
- public function addUser(\Acme\UserBundle\Entity\User $users)
- {
- $this->users[] = $users;
- return $this;
- }
- /**
- * Remove users
- *
- * @param \Acme\UserBundle\Entity\User $users
- */
- public function removeUser(\Acme\UserBundle\Entity\User $users)
- {
- $this->users->removeElement($users);
- }
- /**
- * Get users
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getUsers()
- {
- return $this->users;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement