mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-10-31 17:29:04 +00:00 
			
		
		
		
	Refactored reciever group and adapted testing namespaces
This commit is contained in:
		
							
								
								
									
										34
									
								
								application/src/Entity/Meta/Reciever.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								application/src/Entity/Meta/Reciever.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Entity\Meta; | ||||
|  | ||||
| use Doctrine\Common\Collections\ArrayCollection; | ||||
| use Doctrine\ORM\Mapping as ORM; | ||||
| use Fresh\DoctrineEnumBundle\Validator\Constraints as DoctrineAssert; | ||||
| use App\Entity\Attribut\RelationAttribut; | ||||
| use App\Entity\Attribut\RelationAttributInterface; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  * @ORM\Table(name="meta_reciever_group") | ||||
|  * @ORM\Entity() | ||||
|  */ | ||||
| class Reciever extends AbstractMeta implements RecieverInterface | ||||
| { | ||||
|     use RelationAttribut; | ||||
|  | ||||
|     /** | ||||
|      * The node for which the right exists. | ||||
|      * | ||||
|      * @ORM\ManyToOne(targetEntity="Relation") | ||||
|      * @ORM\JoinColumn(name="relation_id", referencedColumnName="id") | ||||
|      * | ||||
|      * @var RelationAttributInterface | ||||
|      */ | ||||
|     protected $relation; | ||||
|  | ||||
|     public function getAllRecievers(): ArrayCollection | ||||
|     { | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -1,53 +0,0 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Entity\Meta; | ||||
|  | ||||
| use App\Entity\Attribut\RecieverAttribut; | ||||
| use Doctrine\Common\Collections\ArrayCollection; | ||||
| 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\Attribut\RelationAttribut; | ||||
| use App\Entity\Attribut\RelationAttributInterface; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  * @ORM\Table(name="meta_reciever_group") | ||||
|  * @ORM\Entity() | ||||
|  */ | ||||
| final class RecieverGroup extends AbstractMeta implements RecieverGroupInterface | ||||
| { | ||||
|     use RelationAttribut,RecieverAttribut; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Column(name="reciever", type="RecieverType", nullable=false) | ||||
|      * @DoctrineAssert\Enum(entity="App\DBAL\Types\RecieverType") | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $reciever; | ||||
|  | ||||
|     /** | ||||
|      * The node for which the right exists. | ||||
|      * | ||||
|      * @ORM\ManyToOne(targetEntity="Relation") | ||||
|      * @ORM\JoinColumn(name="relation_id", referencedColumnName="id") | ||||
|      * | ||||
|      * @var RelationAttributInterface | ||||
|      */ | ||||
|     protected $relation; | ||||
|  | ||||
|     public function getAllRecievers(): ArrayCollection | ||||
|     { | ||||
|         switch ($this->reciever) { | ||||
|             case RecieverType::PARENTS: | ||||
|                 return $this->node->getParents(); | ||||
|             case RecieverType::NODE: | ||||
|                 return new ArrayCollection([$this->node]); | ||||
|             case RecieverType::CHILDREN: | ||||
|                 return $this->node->getChilds(); | ||||
|         } | ||||
|         throw new NotImplementedException('Reciever '.$this->reciever.' not implemented.'); | ||||
|     } | ||||
| } | ||||
| @@ -2,14 +2,13 @@ | ||||
| 
 | ||||
| namespace App\Entity\Meta; | ||||
| 
 | ||||
| use App\Entity\Attribut\RecieverAttributInterface; | ||||
| use Doctrine\Common\Collections\ArrayCollection; | ||||
| use App\Entity\Attribut\RelationAttributInterface; | ||||
| 
 | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| interface RecieverGroupInterface extends RelationAttributInterface, RecieverAttributInterface, MetaInterface | ||||
| interface RecieverInterface extends RelationAttributInterface, MetaInterface | ||||
| { | ||||
|     public function getAllRecievers(): ArrayCollection; | ||||
| } | ||||
| @@ -11,7 +11,7 @@ use App\DBAL\Types\RightType; | ||||
| use App\Entity\Attribut\GrantAttribut; | ||||
| use App\Logic\Operation\OperationInterface; | ||||
| use App\Entity\Attribut\ConditionAttribut; | ||||
| use App\Entity\Attribut\RecieverGroupAttribut; | ||||
| use App\Entity\Attribut\RecieverAttribut; | ||||
| use App\Entity\Attribut\LayerAttribut; | ||||
| use App\Entity\Attribut\RelationAttribut; | ||||
|  | ||||
| @@ -22,7 +22,7 @@ use App\Entity\Attribut\RelationAttribut; | ||||
|  */ | ||||
| final class Right extends AbstractMeta implements RightInterface | ||||
| { | ||||
|     use TypeAttribut,LawAttribut, RelationAttribut, GrantAttribut,ConditionAttribut,RecieverGroupAttribut,LayerAttribut; | ||||
|     use TypeAttribut,LawAttribut, RelationAttribut, GrantAttribut,ConditionAttribut,RecieverAttribut,LayerAttribut; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\ManyToOne(targetEntity="Law", inversedBy="rights") | ||||
| @@ -44,9 +44,9 @@ final class Right extends AbstractMeta implements RightInterface | ||||
|      * @ORM\OneToOne(targetEntity="RecieverGroup",cascade={"persist", "remove"}) | ||||
|      * @ORM\JoinColumn(name="reciever_id", referencedColumnName="id") | ||||
|      * | ||||
|      * @var RecieverGroupInterface | ||||
|      * @var RecieverInterface | ||||
|      */ | ||||
|     protected $recieverGroup; | ||||
|     protected $reciever; | ||||
|  | ||||
|     /** | ||||
|      * @ORM\Column(type="boolean",name="`grant`") | ||||
|   | ||||
| @@ -4,7 +4,7 @@ namespace App\Entity\Meta; | ||||
|  | ||||
| use App\Entity\Attribut\TypeAttributInterface; | ||||
| use App\Entity\Attribut\LawAttributInterface; | ||||
| use App\Entity\Attribut\RecieverGroupAttributInterface; | ||||
| use App\Entity\Attribut\RecieverAttributInterface; | ||||
| use App\Entity\Attribut\GrantAttributInterface; | ||||
| use App\Entity\Attribut\ConditionAttributInterface; | ||||
| use App\Entity\Attribut\LayerAttributInterface; | ||||
| @@ -14,6 +14,6 @@ use App\Entity\Attribut\RelationAttributInterface; | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| interface RightInterface extends TypeAttributInterface, LawAttributInterface, RelationGrantedInterface, GrantAttributInterface, RecieverGroupAttributInterface, RelationAttributInterface, ConditionAttributInterface, LayerAttributInterface, MetaInterface | ||||
| interface RightInterface extends TypeAttributInterface, LawAttributInterface, RelationGrantedInterface, GrantAttributInterface, RecieverAttributInterface, RelationAttributInterface, ConditionAttributInterface, LayerAttributInterface, MetaInterface | ||||
| { | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user