mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-04 03:07:58 +00:00 
			
		
		
		
	Implemented NameSpacePathMap as attribut
This commit is contained in:
		@@ -8,6 +8,7 @@ use App\Domain\TemplateManagement\TemplatePathFormAndView;
 | 
			
		||||
use App\Domain\FormManagement\FormMetaInformationInterface;
 | 
			
		||||
use App\Domain\FormManagement\FormMetaInformation;
 | 
			
		||||
use App\Domain\PathManagement\NamespacePathMapInterface;
 | 
			
		||||
use App\Domain\PathManagement\NamespacePathMap;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
@@ -29,11 +30,6 @@ class EntityMetaInformation implements EntityMetaInformationInterface
 | 
			
		||||
     */
 | 
			
		||||
    private $templatePathFormAndView;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    private $basicPathArray;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
@@ -49,11 +45,6 @@ class EntityMetaInformation implements EntityMetaInformationInterface
 | 
			
		||||
     */
 | 
			
		||||
    private $formMetaInformation;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    private $basicPathString;
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * @var NamespacePathMapInterface
 | 
			
		||||
     */
 | 
			
		||||
@@ -67,31 +58,23 @@ class EntityMetaInformation implements EntityMetaInformationInterface
 | 
			
		||||
        $this->entity = $entity;
 | 
			
		||||
        $this->entityReflection = new \ReflectionClass($entity);
 | 
			
		||||
        $this->setBasicPathArray();
 | 
			
		||||
        $this->setBasicPathString();
 | 
			
		||||
        $this->setPureName();
 | 
			
		||||
        $this->setInterfaceReflection();
 | 
			
		||||
        $this->setTemplatePathFormAndView();
 | 
			
		||||
        $this->formMetaInformation = new FormMetaInformation($this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function setBasicPathString(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->basicPathString = implode('/', $this->basicPathArray);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function setTemplatePathFormAndView(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->templatePathFormAndView = new TemplatePathFormAndView(implode('/', $this->basicPathArray), $this->pureName);
 | 
			
		||||
        $this->templatePathFormAndView = new TemplatePathFormAndView($this->namespacePathMap->getPath(), $this->pureName);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function setBasicPathArray(): void
 | 
			
		||||
    {
 | 
			
		||||
        $namespace = $this->entityReflection->getNamespaceName();
 | 
			
		||||
        $namespaceWithoutRoot = str_replace('App\\Entity\\', '', $namespace);
 | 
			
		||||
        $this->basicPathArray = [];
 | 
			
		||||
        foreach (explode('\\', $namespaceWithoutRoot) as $element) {
 | 
			
		||||
            $this->basicPathArray[] = strtolower($element);
 | 
			
		||||
        }
 | 
			
		||||
        $this->namespacePathMap = new NamespacePathMap();
 | 
			
		||||
        $this->namespacePathMap->setNamespace($namespaceWithoutRoot);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function setInterfaceReflection(): void
 | 
			
		||||
@@ -106,16 +89,6 @@ class EntityMetaInformation implements EntityMetaInformationInterface
 | 
			
		||||
        $this->pureName = strtolower($withoutAbstract);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     *
 | 
			
		||||
     * @see \App\Domain\EntityManagement\EntityMetaInformationInterface::getBasicPathArray()
 | 
			
		||||
     */
 | 
			
		||||
    public function getBasicPathArray(): array
 | 
			
		||||
    {
 | 
			
		||||
        return $this->basicPathArray;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     *
 | 
			
		||||
@@ -179,10 +152,10 @@ class EntityMetaInformation implements EntityMetaInformationInterface
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     *
 | 
			
		||||
     * @see \App\Domain\EntityManagement\EntityMetaInformationInterface::getBasicPathString()
 | 
			
		||||
     * @see \App\Domain\EntityManagement\EntityMetaInformationInterface::getNamespacePathMap()
 | 
			
		||||
     */
 | 
			
		||||
    public function getBasicPathString(): string
 | 
			
		||||
    public function getNamespacePathMap(): NamespacePathMapInterface
 | 
			
		||||
    {
 | 
			
		||||
        return $this->basicPathString;
 | 
			
		||||
        return $this->namespacePathMap;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,8 @@ namespace App\Domain\EntityManagement;
 | 
			
		||||
use App\Entity\EntityInterface;
 | 
			
		||||
use App\Domain\TemplateManagement\TemplatePathFormAndViewInterface;
 | 
			
		||||
use App\Domain\FormManagement\FormMetaInformationInterface;
 | 
			
		||||
use App\Domain\PathManagement\NamespacePathMap;
 | 
			
		||||
use App\Domain\PathManagement\NamespacePathMapInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Offers informations, which the system needs to handle Entities.
 | 
			
		||||
@@ -28,11 +30,6 @@ interface EntityMetaInformationInterface
 | 
			
		||||
     */
 | 
			
		||||
    public function getTemplatePathFormAndView(): TemplatePathFormAndViewInterface;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return array the namespace elements without the root
 | 
			
		||||
     */
 | 
			
		||||
    public function getBasicPathArray(): array;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return string Short class name in lower case without "Abstract"
 | 
			
		||||
     */
 | 
			
		||||
@@ -49,7 +46,7 @@ interface EntityMetaInformationInterface
 | 
			
		||||
    public function getFormMetaInformation(): FormMetaInformationInterface;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return string
 | 
			
		||||
     * @return NamespacePathMap
 | 
			
		||||
     */
 | 
			
		||||
    public function getBasicPathString(): string;
 | 
			
		||||
    public function getNamespacePathMap(): NamespacePathMapInterface;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@ final class FormMetaInformation implements FormMetaInformationInterface
 | 
			
		||||
    private function setFormClass(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->formClass = 'App\\Form';
 | 
			
		||||
        foreach ($this->entityMetaInformation->getBasicPathArray() as $element) {
 | 
			
		||||
        foreach ($this->entityMetaInformation->getNamespacePathMap()->getFolders() as $element) {
 | 
			
		||||
            $this->formClass .= '\\'.ucfirst($element);
 | 
			
		||||
        }
 | 
			
		||||
        $this->formClass .= '\\'.ucfirst($this->entityMetaInformation->getPureName()).'Type';
 | 
			
		||||
 
 | 
			
		||||
@@ -115,4 +115,14 @@ final class TemplatePathInformation implements TemplatePathInformationInterface
 | 
			
		||||
        $this->type = $type;
 | 
			
		||||
        $this->init();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     *
 | 
			
		||||
     * @see \App\Domain\TemplateManagement\TemplatePathInformationInterface::getType()
 | 
			
		||||
     */
 | 
			
		||||
    public function getType(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->type;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,8 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Domain\TemplateManagement;
 | 
			
		||||
 | 
			
		||||
use App\DBAL\Types\RESTResponseType;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Manages all informations which are needed to process templates.
 | 
			
		||||
 *
 | 
			
		||||
@@ -18,4 +20,11 @@ interface TemplatePathInformationInterface extends ReloadTypeInterface
 | 
			
		||||
     * @return string a template without a frame
 | 
			
		||||
     */
 | 
			
		||||
    public function getAtomTemplatePath(): string;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @see RESTResponseType::$choices
 | 
			
		||||
     *
 | 
			
		||||
     * @return string Type of the template
 | 
			
		||||
     */
 | 
			
		||||
    public function getType(): string;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user