Optimized implementation of format types

This commit is contained in:
Kevin Frantz
2018-09-14 18:26:09 +02:00
parent f8138fb361
commit 66008bc309
21 changed files with 185 additions and 89 deletions

View File

@@ -23,5 +23,6 @@ class AbstractEntity
protected function __construct()
{
$this->id = 0;
}
}

View File

@@ -2,8 +2,8 @@
namespace App\Entity\Attribut;
use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\NodeInterface;
use Doctrine\Common\Collections\Collection;
/**
* @author kevinfrantz
@@ -19,16 +19,16 @@ trait ChildsAttribut
* inverseJoinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")}
* )
*
* @var ArrayCollection|NodeInterface[]
* @var Collection|NodeInterface[]
*/
protected $childs;
public function getChilds(): ArrayCollection
public function getChilds(): Collection
{
return $this->getChilds();
return $this->childs;
}
public function setChilds(ArrayCollection $childs): void
public function setChilds(Collection $childs): void
{
$this->childs = $childs;
}

View File

@@ -2,14 +2,14 @@
namespace App\Entity\Attribut;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
/**
* @author kevinfrantz
*/
interface ChildsAttributeInterface
{
public function setChilds(ArrayCollection $childs): void;
public function setChilds(Collection $childs): void;
public function getChilds(): ArrayCollection;
public function getChilds(): Collection;
}

View File

@@ -2,8 +2,8 @@
namespace App\Entity\Attribut;
use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\NodeInterface;
use Doctrine\Common\Collections\Collection;
/**
* @author kevinfrantz
@@ -19,16 +19,16 @@ trait ParentsAttribut
* inverseJoinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")}
* )
*
* @var ArrayCollection|NodeInterface[]
* @var Collection|NodeInterface[]
*/
protected $parents;
public function getParents(): ArrayCollection
public function getParents(): Collection
{
return $this->parents;
}
public function setParents(ArrayCollection $parents): void
public function setParents(Collection $parents): void
{
$this->parents = $parents;
}

View File

@@ -2,14 +2,14 @@
namespace App\Entity\Attribut;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
/**
* @author kevinfrantz
*/
interface ParentsAttributInterface
{
public function setParents(ArrayCollection $parents): void;
public function setParents(Collection $parents): void;
public function getParents(): ArrayCollection;
public function getParents(): Collection;
}

View File

@@ -2,8 +2,8 @@
namespace App\Entity\Attribut;
use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\PermissionInterface;
use Doctrine\Common\Collections\Collection;
/**
* @author kevinfrantz
@@ -11,16 +11,16 @@ use App\Entity\PermissionInterface;
trait PermissionsAttribut
{
/**
* @var ArrayCollection
* @var Collection
*/
protected $permissions;
public function setPermissions(ArrayCollection $permissions): void
public function setPermissions(Collection $permissions): void
{
$this->permissions = $permissions;
}
public function getPermissions(): ArrayCollection
public function getPermissions(): Collection
{
return $this->permissions;
}

View File

@@ -2,17 +2,17 @@
namespace App\Entity\Attribut;
use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\PermissionInterface;
use Doctrine\Common\Collections\Collection;
/**
* @author kevinfrantz
*/
interface PermissionsAttributInterface
{
public function setPermissions(ArrayCollection $permissions): void;
public function setPermissions(Collection $permissions): void;
public function getPermissions(): ArrayCollection;
public function getPermissions(): Collection;
public function addPermission(PermissionInterface $permission): void;
}

View File

@@ -21,6 +21,6 @@ trait RightAttribut
public function getRight(): RightInterface
{
return $this->getRight();
return $this->right;
}
}

View File

@@ -2,14 +2,14 @@
namespace App\Entity\Attribut;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
/**
* @author kevinfrantz
*/
interface RightsAttributInterface
{
public function setRights(ArrayCollection $rights): void;
public function setRights(Collection $rights): void;
public function getRights(): ArrayCollection;
public function getRights(): Collection;
}

View File

@@ -2,7 +2,7 @@
namespace App\Entity\Attribut;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
/**
* @author kevinfrantz
@@ -10,16 +10,16 @@ use Doctrine\Common\Collections\ArrayCollection;
trait RightsAttribute
{
/**
* @var ArrayCollection
* @var Collection
*/
protected $rights;
public function setRights(ArrayCollection $rights): void
public function setRights(Collection $rights): void
{
$this->rights = $rights;
}
public function getRights(): ArrayCollection
public function getRights(): Collection
{
return $this->rights;
}

View File

@@ -18,7 +18,7 @@ class Law extends AbstractEntity implements LawInterface
use RightsAttribute, NodeAttribut;
/**
* @ORM\OneToMany(targetEntity="Right", mappedBy="id", cascade={"persist", "remove"})
* @ORM\OneToMany(targetEntity="Right", mappedBy="law", cascade={"persist", "remove"})
*
* @var ArrayCollection
*/

View File

@@ -43,7 +43,7 @@ class Permission extends AbstractEntity implements PermissionInterface
protected $node;
/**
* @ORM\ManyToOne(targetEntity="Right")
* @ORM\ManyToOne(targetEntity="Right",inversedBy="permissions")
* @ORM\JoinColumn(name="right_id", referencedColumnName="id")
*
* @var RightInterface

View File

@@ -9,6 +9,7 @@ use Doctrine\ORM\Mapping as ORM;
use Fresh\DoctrineEnumBundle\Validator\Constraints as DoctrineAssert;
use App\Entity\Attribut\LawAttribut;
use App\Entity\Attribut\PermissionsAttribut;
use Doctrine\Common\Collections\Collection;
/**
* @author kevinfrantz
@@ -20,7 +21,7 @@ class Right extends AbstractEntity implements RightInterface
use TypeAttribut,LawAttribut,PermissionsAttribut;
/**
* @ORM\ManyToOne(targetEntity="Law")
* @ORM\ManyToOne(targetEntity="Law", inversedBy="rights")
* @ORM\JoinColumn(name="law_id", referencedColumnName="id")
*
* @var LawInterface
@@ -36,9 +37,9 @@ class Right extends AbstractEntity implements RightInterface
protected $type;
/**
* @ORM\OneToMany(targetEntity="Permission", mappedBy="id", cascade={"persist", "remove"})
* @ORM\OneToMany(targetEntity="Permission", mappedBy="right", cascade={"persist", "remove"})
*
* @var ArrayCollection
* @var Collection
*/
protected $permissions;