vendor/sulu/sulu/src/Sulu/Bundle/SecurityBundle/Entity/SecurityType.php line 21

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of Sulu.
  4.  *
  5.  * (c) Sulu GmbH
  6.  *
  7.  * This source file is subject to the MIT license that is bundled
  8.  * with this source code in the file LICENSE.
  9.  */
  10. namespace Sulu\Bundle\SecurityBundle\Entity;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use Sulu\Component\Security\Authentication\RoleInterface;
  14. /**
  15.  * SecurityType.
  16.  */
  17. class SecurityType
  18. {
  19.     /**
  20.      * @var string
  21.      */
  22.     private $name;
  23.     /**
  24.      * @var int
  25.      */
  26.     private $id;
  27.     /**
  28.      * @var Collection<int, RoleInterface>
  29.      */
  30.     private $roles;
  31.     /**
  32.      * Constructor.
  33.      */
  34.     public function __construct()
  35.     {
  36.         $this->roles = new ArrayCollection();
  37.     }
  38.     /**
  39.      * Set name.
  40.      *
  41.      * @param string $name
  42.      *
  43.      * @return SecurityType
  44.      */
  45.     public function setName($name)
  46.     {
  47.         $this->name $name;
  48.         return $this;
  49.     }
  50.     /**
  51.      * Get name.
  52.      *
  53.      * @return string
  54.      */
  55.     public function getName()
  56.     {
  57.         return $this->name;
  58.     }
  59.     /**
  60.      * Get id.
  61.      *
  62.      * @return int
  63.      */
  64.     public function getId()
  65.     {
  66.         return $this->id;
  67.     }
  68.     /**
  69.      * Set id.
  70.      *
  71.      * @param int $id
  72.      *
  73.      * @return void
  74.      */
  75.     public function setId($id)
  76.     {
  77.         $this->id $id;
  78.     }
  79.     /**
  80.      * Add roles.
  81.      *
  82.      * @return SecurityType
  83.      */
  84.     public function addRole(RoleInterface $roles)
  85.     {
  86.         $this->roles[] = $roles;
  87.         return $this;
  88.     }
  89.     /**
  90.      * Remove roles.
  91.      *
  92.      * @return void
  93.      */
  94.     public function removeRole(RoleInterface $roles)
  95.     {
  96.         $this->roles->removeElement($roles);
  97.     }
  98.     /**
  99.      * Get roles.
  100.      *
  101.      * @return Collection<int, RoleInterface>
  102.      */
  103.     public function getRoles()
  104.     {
  105.         return $this->roles;
  106.     }
  107. }