<?php
namespace Platform\SecurityBundle\Entity\Access;
use Cms\CoreBundle\Model\EntityRestoreInterface;
use Cms\CoreBundle\Model\EntityRestoreTrait;
use Cms\TenantBundle\Entity\TenantedEntity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
*
* @ORM\Entity(
* repositoryClass = "Platform\SecurityBundle\Doctrine\Access\RoleRepository"
* )
*
* @ORM\InheritanceType("SINGLE_TABLE")
*
* @ORM\DiscriminatorColumn(
* name = "discr",
* type = "string",
* )
*
@ORM\DiscriminatorMap({
* Role\CmsRole::DISCR = "Platform\SecurityBundle\Entity\Access\Role\CmsRole",
* Role\NotificationRole::DISCR = "Platform\SecurityBundle\Entity\Access\Role\NotificationRole",
* })
*
*
* @ORM\Table(
* name = "cms__security__access__role",
* uniqueConstraints = {
* @ORM\UniqueConstraint(
* name = "uidx__unique__role",
* columns = {
* "tenant",
* "name"
* }
* ),
* }
* )
*/
abstract class Role extends TenantedEntity implements EntityRestoreInterface
{
use EntityRestoreTrait;
use RoleRestoreTrait;
public const DISCRS = [
Role\CmsRole::DISCR => Role\CmsRole::class,
Role\NotificationRole::DISCR => Role\NotificationRole::class,
];
/**
* @var string
*
* @ORM\Column(
* type = "string",
* nullable = false
* )
*/
protected $name;
/**
* @var ArrayCollection|RoleAssociation[]
*
* @ORM\OneToMany(
* targetEntity = "RoleAssociation",
* mappedBy = "role"
* )
*/
protected $associations;
/**
*
*/
public function __construct()
{
$this->associations = new ArrayCollection();
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @return ArrayCollection|RoleAssociation[]
*/
public function getAssociations()
{
return $this->associations;
}
/**
* @param string $value
* @return $this
*/
public function setName($value)
{
$this->name = $value;
return $this;
}
}