Added source menu

This commit is contained in:
Kevin Frantz
2018-09-20 14:26:28 +02:00
parent 9ae2290835
commit 3bf84d3ec8
14 changed files with 201 additions and 55 deletions

View File

@@ -1,34 +1,35 @@
<?php
namespace App\Creator\Factory\Form\Source;
use App\Entity\SourceInterface;
/**
*
* @author kevinfrantz
*
*/
class SourceFormFactory
{
const FORM_NAMESPACE = 'App\Form\\';
/**
* @var SourceInterface
*/
private $source;
public function __construct(SourceInterface $source){
public function __construct(SourceInterface $source)
{
$this->source = $source;
}
public function getNamespace():string{
public function getNamespace(): string
{
return self::FORM_NAMESPACE.$this->getName();
}
protected function getName(): string
{
$reflectionClass = new \ReflectionClass($this->source);
return $reflectionClass->getShortName().'Type';
}
}

View File

@@ -13,7 +13,7 @@ class SourceTemplateFactory
const SOURCE_TEMPLATE_ROOT = 'source';
const VIEW_FOLDER = 'view';
/**
* @var SourceInterface
*/

View File

@@ -1,18 +1,16 @@
<?php
namespace App\Creator\Factory\Template\Source;
/**
*
* @author kevinfrantz
*
*/
class SourceTemplateFormFactory extends SourceTemplateFactory
{
const FORM_FOLDER = 'form';
public function getTemplatePath(): string
{
return parent::SOURCE_TEMPLATE_ROOT.'/'.self::FORM_FOLDER.'/'.$this->generateName().'.'.$this->request->getRequestFormat().'.twig';
}
}