Optimized Attributes and tests for it

This commit is contained in:
Kevin Frantz
2019-02-07 13:14:55 +01:00
parent f85b0118a7
commit 25e63d4983
13 changed files with 245 additions and 11 deletions

View File

@@ -5,12 +5,14 @@ namespace App\Attribut;
use Doctrine\Common\Collections\Collection;
/**
* @see ChildsAttributInterface
*
* @author kevinfrantz
*/
trait ChildsAttribut
{
/**
* @var Collection|ChildsAttributeInterface[]
* @var Collection|ChildsAttributInterface[]
*/
protected $childs;

View File

@@ -7,7 +7,7 @@ use Doctrine\Common\Collections\Collection;
/**
* @author kevinfrantz
*/
interface ChildsAttributeInterface
interface ChildsAttributInterface
{
public function setChilds(Collection $childs): void;

View File

@@ -7,6 +7,8 @@ namespace App\Attribut;
*/
interface ClassAttributInterface
{
const CLASS_ATTRIBUT_NAME = 'class';
/**
* @param string $class
*/

View File

@@ -4,6 +4,8 @@ This folder containes the attributs which are used by entity, domain logic etc.
Each attribut containes out of an interface and a trait.
## Interface
The interface MUST define a __get-__ and a __set-method__. Optional an interface can define a __has-method__.
For meta processing an interface SHOULD contain one constant which is named by the schema __<<ATTRIBUT>>_ATTRIBUT_NAME__.
An interface MUST NOT implement other constants.
### Methods
#### Set
The __setter__ MUST return nothing(void). It SHOULD throw an exception if the value is not valid.

View File

@@ -6,8 +6,10 @@ use Doctrine\Common\Collections\Collection;
/**
* @author kevinfrantz
*
* @see RightsAttributInterface
*/
trait RightsAttribute
trait RightsAttribut
{
/**
* @var Collection

View File

@@ -10,6 +10,8 @@ use App\Entity\Meta\RightInterface;
*/
interface RightsAttributInterface
{
const RIGHTS_ATTRIBUT_NAME = 'rights';
/**
* @param Collection|RightInterface[] $rights
*/

View File

@@ -53,6 +53,9 @@ final class FixtureSourceFactory implements FixtureSourceFactoryInterface
return $objects;
}
/**
* @return array
*/
public static function getAllFixtureSources(): array
{
$unfilteredClasses = self::getAllClassesInSourceFixtureNamespace();

View File

@@ -41,6 +41,8 @@ Checks if the crud, layer and source combination is granted by a right.
### Right Layer Combination Service ###
Allows to get the possible cruds for a layer, or the possible layers for a crud.
## Source Management
### Source Class Information Service ###
Offers to get all source classes, or source classes by a namespace.
### Source Member Information ###
Offers to get all source members over all dimensions.
### Source Member Manager

View File

@@ -75,7 +75,7 @@ final class SourceClassInformationService implements SourceClassInformationServi
$this->allClasses[] = $this->transformPathToClass($path);
}
private function loadClasses()
private function loadClasses(): void
{
$recursiveDirectoryIterator = new \RecursiveDirectoryIterator(self::FOLDER);
$files = new \RecursiveIteratorIterator($recursiveDirectoryIterator, \RecursiveIteratorIterator::SELF_FIRST);

View File

@@ -3,7 +3,7 @@
namespace App\Entity\Meta;
use Doctrine\ORM\Mapping as ORM;
use App\Attribut\RightsAttribute;
use App\Attribut\RightsAttribut;
use Doctrine\Common\Collections\ArrayCollection;
use App\Attribut\RelationAttribut;
use App\Entity\Source\SourceInterface;
@@ -16,7 +16,7 @@ use App\Attribut\GrantAttribut;
*/
class Law extends AbstractMeta implements LawInterface
{
use RightsAttribute, RelationAttribut, GrantAttribut;
use RightsAttribut, RelationAttribut, GrantAttribut;
/**
* @ORM\Column(type="boolean",name="`grant`")

View File

@@ -3,9 +3,9 @@
namespace App\Entity\Meta\Relation\Parent;
use App\Attribut\ParentsAttributInterface;
use App\Attribut\ChildsAttributeInterface;
use App\Attribut\ChildsAttributInterface;
use App\Entity\Meta\Relation\RelationInterface;
interface ParentRelationInterface extends RelationInterface, ParentsAttributInterface, ChildsAttributeInterface
interface ParentRelationInterface extends RelationInterface, ParentsAttributInterface, ChildsAttributInterface
{
}