src/Platform/SecurityBundle/Entity/Access/Role.php line 43

Open in your IDE?
  1. <?php
  2. namespace Platform\SecurityBundle\Entity\Access;
  3. use Cms\CoreBundle\Model\EntityRestoreInterface;
  4. use Cms\CoreBundle\Model\EntityRestoreTrait;
  5. use Cms\TenantBundle\Entity\TenantedEntity;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  *
  10.  * @ORM\Entity(
  11.  *  repositoryClass = "Platform\SecurityBundle\Doctrine\Access\RoleRepository"
  12.  * )
  13.  *
  14.  * @ORM\InheritanceType("SINGLE_TABLE")
  15.  *
  16.  * @ORM\DiscriminatorColumn(
  17.  *     name = "discr",
  18.  *     type = "string",
  19.  * )
  20.  *
  21.   @ORM\DiscriminatorMap({
  22.  *     Role\CmsRole::DISCR = "Platform\SecurityBundle\Entity\Access\Role\CmsRole",
  23.  *     Role\NotificationRole::DISCR = "Platform\SecurityBundle\Entity\Access\Role\NotificationRole",
  24.  * })
  25.  *
  26.  *
  27.  * @ORM\Table(
  28.  *      name = "cms__security__access__role",
  29.  *      uniqueConstraints = {
  30.  *          @ORM\UniqueConstraint(
  31.  *              name = "uidx__unique__role",
  32.  *              columns = {
  33.  *                  "tenant",
  34.  *                  "name"
  35.  *              }
  36.  *          ),
  37.  *      }
  38.  * )
  39.  */
  40. abstract class Role extends TenantedEntity implements EntityRestoreInterface
  41. {
  42.     use EntityRestoreTrait;
  43.     use RoleRestoreTrait;
  44.     public const DISCRS = [
  45.         Role\CmsRole::DISCR => Role\CmsRole::class,
  46.         Role\NotificationRole::DISCR => Role\NotificationRole::class,
  47.     ];
  48.     /**
  49.      * @var string
  50.      *
  51.      * @ORM\Column(
  52.      *  type = "string",
  53.      *  nullable = false
  54.      * )
  55.      */
  56.     protected $name;
  57.     /**
  58.      * @var ArrayCollection|RoleAssociation[]
  59.      *
  60.      * @ORM\OneToMany(
  61.      *  targetEntity = "RoleAssociation",
  62.      *  mappedBy = "role"
  63.      * )
  64.      */
  65.     protected $associations;
  66.     /**
  67.      *
  68.      */
  69.     public function __construct()
  70.     {
  71.         $this->associations = new ArrayCollection();
  72.     }
  73.     /**
  74.      * @return string
  75.      */
  76.     public function getName()
  77.     {
  78.         return $this->name;
  79.     }
  80.     /**
  81.      * @return ArrayCollection|RoleAssociation[]
  82.      */
  83.     public function getAssociations()
  84.     {
  85.         return $this->associations;
  86.     }
  87.     /**
  88.      * @param string $value
  89.      * @return $this
  90.      */
  91.     public function setName($value)
  92.     {
  93.         $this->name $value;
  94.         return $this;
  95.     }
  96. }