Added draft for LawController

This commit is contained in:
Kevin Frantz 2018-10-03 18:20:53 +02:00
parent ab15856aa4
commit 94bc8c5da4
7 changed files with 63 additions and 25 deletions

View File

@ -0,0 +1,36 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Annotation\Route;
/**
*
* @author kevinfrantz
*
*/
class LawController extends AbstractController
{
/**
* @Route("/law/{id}.{_format}", defaults={"_format"="html"})
*/
public function show():Response{
//Implement
}
/**
* @Route("/law/{id}/right.{_format}", defaults={"_format"="html"})
*/
public function right(int $id):RedirectResponse{
//Implement
}
/**
* @Route("/law/{id}/node.{_format}", defaults={"_format"="html"})
*/
public function node(int $id):RedirectResponse{
//Implement
}
}

View File

@ -37,7 +37,6 @@ class NodeController extends FOSRestController
if (!$node) { if (!$node) {
throw $this->createNotFoundException('No node found for id '.$id); throw $this->createNotFoundException('No node found for id '.$id);
} }
return $node; return $node;
} }
} }

View File

@ -11,14 +11,6 @@ use Doctrine\Common\Collections\Collection;
trait ChildsAttribut trait ChildsAttribut
{ {
/** /**
* Many Nodes have many childs.
*
* @ORM\ManyToMany(targetEntity="Node")
* @ORM\JoinTable(name="nodes_childs",
* joinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")}
* )
*
* @var Collection|NodeInterface[] * @var Collection|NodeInterface[]
*/ */
protected $childs; protected $childs;

View File

@ -11,14 +11,6 @@ use Doctrine\Common\Collections\Collection;
trait ParentsAttribut trait ParentsAttribut
{ {
/** /**
* Many Nodes have many parents.
*
* @ORM\ManyToMany(targetEntity="Node")
* @ORM\JoinTable(name="nodes_parents",
* joinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")}
* )
*
* @var Collection|NodeInterface[] * @var Collection|NodeInterface[]
*/ */
protected $parents; protected $parents;

View File

@ -6,8 +6,6 @@ use Doctrine\ORM\Mapping as ORM;
use App\Entity\Attribut\RightsAttribute; use App\Entity\Attribut\RightsAttribute;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Attribut\NodeAttribut; use App\Entity\Attribut\NodeAttribut;
use App\Entity\LawInterface;
use App\Entity\NodeInterface;
/** /**
* @author kevinfrantz * @author kevinfrantz
@ -45,8 +43,7 @@ class Law extends AbstractEntity implements LawInterface
public function isGranted(NodeInterface $node, string $layer, string $right): bool public function isGranted(NodeInterface $node, string $layer, string $right): bool
{ {
/* /**
*
* @var RightInterface * @var RightInterface
*/ */
foreach ($this->rights->toArray() as $right) { foreach ($this->rights->toArray() as $right) {

View File

@ -9,9 +9,8 @@ use App\Entity\Attribut\ParentsAttribut;
use App\Entity\Attribut\ChildsAttribut; use App\Entity\Attribut\ChildsAttribut;
use App\Entity\Attribut\LawAttribut; use App\Entity\Attribut\LawAttribut;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\NodeInterface;
use App\Entity\Source\SourceInterface; use App\Entity\Source\SourceInterface;
use App\Entity\LawInterface; use Doctrine\Common\Collections\Collection;
/** /**
* @author kevinfrantz * @author kevinfrantz
@ -25,6 +24,31 @@ class Node extends AbstractEntity implements NodeInterface
ParentsAttribut, ParentsAttribut,
LawAttribut, LawAttribut,
ChildsAttribut; ChildsAttribut;
/**
* Many Nodes have many parents.
* @ORM\ManyToMany(targetEntity="Node")
* @ORM\JoinTable(name="nodes_parents",
* joinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")}
* )
*
* @var Collection|NodeInterface[]
*/
protected $parents;
/**
* Many Nodes have many childs.
*
* @ORM\ManyToMany(targetEntity="Node")
* @ORM\JoinTable(name="nodes_childs",
* joinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")}
* )
*
* @var Collection|NodeInterface[]
*/
protected $childs;
/** /**
* @ORM\OneToOne(targetEntity="App\Entity\Source\AbstractSource",cascade={"persist", "remove"}) * @ORM\OneToOne(targetEntity="App\Entity\Source\AbstractSource",cascade={"persist", "remove"})

View File

@ -9,8 +9,6 @@ use App\DBAL\Types\RecieverType;
use Symfony\Component\Intl\Exception\NotImplementedException; use Symfony\Component\Intl\Exception\NotImplementedException;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Fresh\DoctrineEnumBundle\Validator\Constraints as DoctrineAssert; use Fresh\DoctrineEnumBundle\Validator\Constraints as DoctrineAssert;
use App\Entity\RecieverGroupInterface;
use App\Entity\NodeInterface;
/** /**
* @author kevinfrantz * @author kevinfrantz