sf4 deprecated: migrate Doctrine ORM mapping to annotation

This commit is contained in:
2020-07-24 14:51:34 +02:00
parent 3033be78d2
commit 2746d3e003
20 changed files with 434 additions and 410 deletions

View File

@@ -20,18 +20,26 @@
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;
/**
*
* @ORM\Entity()
* @ORM\Table(name="scopes")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class Scope
{
/**
* @var integer
*
* @var int
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
@@ -39,22 +47,31 @@ class Scope
* translatable names
*
* @var array
*
* @ORM\Column(type="json_array")
*/
private $name = array();
private $name = [];
/**
* @var Collection
*
* @var \Doctrine\Common\Collections\Collection
* @ORM\OneToMany(
* targetEntity="Chill\MainBundle\Entity\RoleScope",
* mappedBy="scope")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/
private $roleScopes;
/**
* Scope constructor.
*/
public function __construct()
{
$this->roleScopes = new \Doctrine\Common\Collections\ArrayCollection();
$this->roleScopes = new ArrayCollection();
}
/**
*
* @return int
*/
public function getId()
@@ -63,14 +80,17 @@ class Scope
}
/**
*
* @return array
*/
public function getName()
{
return $this->name;
}
/**
* @param $name
* @return $this
*/
public function setName($name)
{
$this->name = $name;
@@ -78,14 +98,16 @@ class Scope
}
/**
*
* @return \Doctrine\Common\Collections\Collection
* @return Collection
*/
public function getRoleScopes()
{
return $this->roleScopes;
}
/**
* @param RoleScope $roleScope
*/
public function addRoleScope(RoleScope $roleScope)
{
$this->roleScopes->add($roleScope);