Optimized RequestedEntityFormBuilderService and implemented form classes and logic

This commit is contained in:
Kevin Frantz
2019-02-03 15:21:45 +01:00
parent c3b8e1a92d
commit ed3062a203
18 changed files with 247 additions and 79 deletions

View File

@@ -2,16 +2,55 @@
namespace App\Domain\ActionManagement\Create;
use App\Domain\SourceManagement\SourceClassInformationService;
use App\Form\Source\SourceType;
use App\Entity\Source\AbstractSource;
/**
* @author kevinfrantz
*/
final class CreateSourceAction extends AbstractCreateAction
{
protected function isValidByForm(): bool
/**
* @var string default class name, when no parameter is defined
*/
const DEFAULT_CLASS = AbstractSource::class;
/**
* @see SourceClassInformationService
*
* @var string The source class which should be used
*/
private $sourceClass;
private function setSourceClass(): void
{
$request = $this->actionService->getRequest();
$this->sourceClass = $request->get(SourceType::CLASS_PARAMETER_NAME, self::DEFAULT_CLASS);
}
private function prepare(): void
{
$this->setSourceClass();
}
/**
* {@inheritdoc}
*
* @see \App\Domain\ActionManagement\AbstractAction::isValidByForm()
*/
protected function isValidByForm(): bool
{
$this->actionService->getForm();
}
/**
* {@inheritdoc}
*
* @see \App\Domain\ActionManagement\AbstractAction::proccess()
*/
protected function proccess()
{
$this->prepare();
}
}