mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-10-31 01:09:41 +00:00 
			
		
		
		
	Implemented formMeta
This commit is contained in:
		| @@ -3,14 +3,55 @@ | ||||
| namespace App\Domain\FormManagement; | ||||
|  | ||||
| use App\Domain\SourceManagement\SourceMetaInterface; | ||||
| use App\Domain\TemplateManagement\TemplateMetaInterface; | ||||
| use App\Domain\TemplateManagement\TemplateMeta; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
|  */ | ||||
| class FormMeta implements FormMetaInterface | ||||
| { | ||||
|     public function __construct(SourceMetaInterface $source) | ||||
|     const FOLDER = 'form'; | ||||
|  | ||||
|     /** | ||||
|      * @var SourceMetaInterface | ||||
|      */ | ||||
|     private $sourceMeta; | ||||
|  | ||||
|     /** | ||||
|      * @var TemplateMetaInterface | ||||
|      */ | ||||
|     private $templateMeta; | ||||
|  | ||||
|     /** | ||||
|      * @var string | ||||
|      */ | ||||
|     private $formClass; | ||||
|  | ||||
|     public function __construct(SourceMetaInterface $sourceMeta) | ||||
|     { | ||||
|         $this->sourceMeta = $sourceMeta; | ||||
|         $this->setMeta(); | ||||
|         $this->setFormClass(); | ||||
|     } | ||||
|  | ||||
|     public function getFormPath(): string | ||||
|     private function setFormClass(): void | ||||
|     { | ||||
|         $this->formClass = 'App\\Form\\'.implode('\\', $this->sourceMeta->getBasicPathArray()).'\\'.$this->sourceMeta->getBasicName().'Type'; | ||||
|     } | ||||
|  | ||||
|     private function setMeta(): void | ||||
|     { | ||||
|         $this->templateMeta = new TemplateMeta($this->sourceMeta->getBasicPathArray(), $this->sourceMeta->getBasicName(), self::FOLDER); | ||||
|     } | ||||
|  | ||||
|     public function getFormClass(): string | ||||
|     { | ||||
|         return $this->formClass; | ||||
|     } | ||||
|  | ||||
|     public function getTemplateMeta(): string | ||||
|     { | ||||
|         return $this->templateMeta; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -4,5 +4,7 @@ namespace App\Domain\FormManagement; | ||||
|  | ||||
| interface FormMetaInterface | ||||
| { | ||||
|     public function getFormPath(): string; | ||||
|     public function getFormClass(): string; | ||||
|  | ||||
|     public function getTemplateMeta(): string; | ||||
| } | ||||
|   | ||||
| @@ -2,9 +2,11 @@ | ||||
|  | ||||
| namespace App\Domain\SourceManagement; | ||||
|  | ||||
| use App\Domain\FormManagement\FormMetaInterface; | ||||
| use App\Domain\TemplateManagement\TemplateMetaInterface; | ||||
| use App\Entity\Source\SourceInterface; | ||||
| use App\Domain\TemplateManagement\TemplateMeta; | ||||
| use App\Domain\FormManagement\FormMeta; | ||||
|  | ||||
| /** | ||||
|  * @author kevinfrantz | ||||
| @@ -41,6 +43,11 @@ class SourceMeta implements SourceMetaInterface | ||||
|      */ | ||||
|     private $source; | ||||
|  | ||||
|     /** | ||||
|      * @var FormMetaInterface | ||||
|      */ | ||||
|     private $formMeta; | ||||
|  | ||||
|     public function __construct(SourceInterface $source) | ||||
|     { | ||||
|         $this->source = $source; | ||||
| @@ -48,7 +55,8 @@ class SourceMeta implements SourceMetaInterface | ||||
|         $this->setBasicPathArray(); | ||||
|         $this->setBasicName(); | ||||
|         $this->setInterfaceReflection(); | ||||
|         $this->templateMeta = new TemplateMeta($this); | ||||
|         $this->templateMeta = new TemplateMeta($this->basicPathArray, $this->basicName, 'entity'); | ||||
|         $this->formMeta = new FormMeta($this); | ||||
|     } | ||||
|  | ||||
|     private function setBasicPathArray(): void | ||||
| @@ -103,4 +111,9 @@ class SourceMeta implements SourceMetaInterface | ||||
|     { | ||||
|         return $this->source; | ||||
|     } | ||||
|  | ||||
|     public function getFormMeta(): FormMetaInterface | ||||
|     { | ||||
|         return $this->formMeta; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -4,6 +4,7 @@ namespace App\Domain\SourceManagement; | ||||
|  | ||||
| use App\Domain\TemplateManagement\TemplateMetaInterface; | ||||
| use App\Entity\Source\SourceInterface; | ||||
| use App\Domain\FormManagement\FormMetaInterface; | ||||
|  | ||||
| /** | ||||
|  * A meta source offers informations, which the system needs to handle the source. | ||||
| @@ -32,4 +33,6 @@ interface SourceMetaInterface | ||||
|      * @return SourceInterface The source to which the meta object belongs to | ||||
|      */ | ||||
|     public function getSource(): SourceInterface; | ||||
|  | ||||
|     public function getFormMeta(): FormMetaInterface; | ||||
| } | ||||
|   | ||||
| @@ -2,7 +2,6 @@ | ||||
|  | ||||
| namespace App\Domain\TemplateManagement; | ||||
|  | ||||
| use App\Domain\SourceManagement\SourceMetaInterface; | ||||
| use App\DBAL\Types\TemplateType; | ||||
|  | ||||
| /** | ||||
| @@ -11,9 +10,14 @@ use App\DBAL\Types\TemplateType; | ||||
| class TemplateMeta implements TemplateMetaInterface | ||||
| { | ||||
|     /** | ||||
|      * @var SourceMetaInterface | ||||
|      * @var array | ||||
|      */ | ||||
|     private $sourceMeta; | ||||
|     private $basicPathArray; | ||||
|  | ||||
|     /** | ||||
|      * @var string | ||||
|      */ | ||||
|     private $basicName; | ||||
|  | ||||
|     /** | ||||
|      * @var string | ||||
| @@ -35,9 +39,16 @@ class TemplateMeta implements TemplateMetaInterface | ||||
|      */ | ||||
|     private $contentTemplatePath; | ||||
|  | ||||
|     public function __construct(SourceMetaInterface $sourceMeta) | ||||
|     /** | ||||
|      * @var string | ||||
|      */ | ||||
|     private $folder; | ||||
|  | ||||
|     public function __construct(array $basicPathArray, string $basicName, string $folder) | ||||
|     { | ||||
|         $this->sourceMeta = $sourceMeta; | ||||
|         $this->basicPathArray = $basicPathArray; | ||||
|         $this->basicName = $basicName; | ||||
|         $this->folder = $folder; | ||||
|         $this->init(); | ||||
|     } | ||||
|  | ||||
| @@ -50,7 +61,7 @@ class TemplateMeta implements TemplateMetaInterface | ||||
|  | ||||
|     private function setPathSuffix(): void | ||||
|     { | ||||
|         $this->pathSuffix = implode('/', $this->sourceMeta->getBasicPathArray()).'/'.$this->sourceMeta->getBasicName().'.'.$this->type.'.twig'; | ||||
|         $this->pathSuffix = $this->folder.'/'.implode('/', $this->basicPathArray).'/'.$this->basicName.'.'.$this->type.'.twig'; | ||||
|     } | ||||
|  | ||||
|     private function setFrameTemplatePath(): void | ||||
| @@ -83,4 +94,9 @@ class TemplateMeta implements TemplateMetaInterface | ||||
|     { | ||||
|         return $this->type; | ||||
|     } | ||||
|  | ||||
|     public function getPathSuffix(): string | ||||
|     { | ||||
|         return $this->pathSuffix; | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user