mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-01 04:23:49 +00:00
sf4 deprecated: migrate Doctrine ORM mapping to annotation
This commit is contained in:
@@ -20,72 +20,103 @@
|
||||
|
||||
namespace Chill\MainBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Chill\MainBundle\Entity\RoleScope;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(name="permission_groups")
|
||||
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
*/
|
||||
class PermissionsGroup
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @var int
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(type="string", length=255)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string[]
|
||||
*
|
||||
* @ORM\Column(type="json")
|
||||
*/
|
||||
private $flags = [];
|
||||
|
||||
/**
|
||||
* @var Collection
|
||||
*
|
||||
* @var \Doctrine\Common\Collections\Collection
|
||||
* @ORM\ManyToMany(
|
||||
* targetEntity="Chill\MainBundle\Entity\RoleScope",
|
||||
* inversedBy="permissionsGroups",
|
||||
* cascade={ "persist" })
|
||||
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
|
||||
*/
|
||||
private $roleScopes;
|
||||
|
||||
/**
|
||||
* @var Collection
|
||||
*
|
||||
* @var \Doctrine\Common\Collections\Collection
|
||||
* @ORM\OneToMany(
|
||||
* targetEntity="Chill\MainBundle\Entity\GroupCenter",
|
||||
* mappedBy="permissionsGroup"
|
||||
* )
|
||||
*/
|
||||
private $groupCenters;
|
||||
|
||||
|
||||
/**
|
||||
* PermissionsGroup constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->roleScopes = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->groupCenters = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return ArrayCollection|Collection
|
||||
*/
|
||||
public function getRoleScopes()
|
||||
{
|
||||
return $this->roleScopes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
@@ -93,7 +124,6 @@ class PermissionsGroup
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param RoleScope $roleScope
|
||||
*/
|
||||
public function addRoleScope(RoleScope $roleScope)
|
||||
@@ -102,7 +132,6 @@ class PermissionsGroup
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param RoleScope $roleScope
|
||||
* @throws \RuntimeException if the roleScope could not be removed.
|
||||
*/
|
||||
@@ -115,21 +144,28 @@ class PermissionsGroup
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getFlags()
|
||||
{
|
||||
return $this->flags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $flags
|
||||
* @return $this
|
||||
*/
|
||||
public function setFlags(array $flags)
|
||||
{
|
||||
$this->flags = $flags;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test that a role scope is associated only once with the permission group
|
||||
* Test that a role scope is associated only once
|
||||
* with the permission group
|
||||
*
|
||||
* @param ExecutionContextInterface $context
|
||||
*/
|
||||
@@ -150,5 +186,4 @@ class PermissionsGroup
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user