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) {
throw $this->createNotFoundException('No node found for id '.$id);
}
return $node;
}
}

View File

@ -11,14 +11,6 @@ use Doctrine\Common\Collections\Collection;
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[]
*/
protected $childs;

View File

@ -11,14 +11,6 @@ use Doctrine\Common\Collections\Collection;
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[]
*/
protected $parents;

View File

@ -6,8 +6,6 @@ use Doctrine\ORM\Mapping as ORM;
use App\Entity\Attribut\RightsAttribute;
use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Attribut\NodeAttribut;
use App\Entity\LawInterface;
use App\Entity\NodeInterface;
/**
* @author kevinfrantz
@ -45,8 +43,7 @@ class Law extends AbstractEntity implements LawInterface
public function isGranted(NodeInterface $node, string $layer, string $right): bool
{
/*
*
/**
* @var RightInterface
*/
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\LawAttribut;
use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\NodeInterface;
use App\Entity\Source\SourceInterface;
use App\Entity\LawInterface;
use Doctrine\Common\Collections\Collection;
/**
* @author kevinfrantz
@ -26,6 +25,31 @@ class Node extends AbstractEntity implements NodeInterface
LawAttribut,
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\JoinColumn(name="source_id", referencedColumnName="id")

View File

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