mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-04-16 10:16:22 +02:00
Refactored some functions to ViewBuilder
This commit is contained in:
parent
96ea4b14a2
commit
9a95abbaba
@ -12,6 +12,7 @@ use Infinito\Domain\FormManagement\RequestedActionFormBuilderServiceInterface;
|
|||||||
use Infinito\Domain\RequestManagement\Action\RequestedActionServiceInterface;
|
use Infinito\Domain\RequestManagement\Action\RequestedActionServiceInterface;
|
||||||
use Infinito\Domain\SecureManagement\SecureRequestedRightCheckerServiceInterface;
|
use Infinito\Domain\SecureManagement\SecureRequestedRightCheckerServiceInterface;
|
||||||
use Infinito\Entity\Source\Primitive\Text\TextSource;
|
use Infinito\Entity\Source\Primitive\Text\TextSource;
|
||||||
|
use Infinito\Domain\ViewManagement\ViewBuilderInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
@ -23,11 +24,6 @@ final class MVCRoutineService implements MVCRoutineServiceInterface
|
|||||||
{
|
{
|
||||||
use ActionTypeAttribut;
|
use ActionTypeAttribut;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string The path to the general entity template
|
|
||||||
*/
|
|
||||||
const TWIG_ENTITY_TEMPLATE_PATH = 'entity/entity.html.twig';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ActionHandlerServiceInterface
|
* @var ActionHandlerServiceInterface
|
||||||
*/
|
*/
|
||||||
@ -59,20 +55,20 @@ final class MVCRoutineService implements MVCRoutineServiceInterface
|
|||||||
private $secureRequestedRightCheckerService;
|
private $secureRequestedRightCheckerService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return View
|
* @var ViewBuilderInterface
|
||||||
*/
|
*/
|
||||||
private function getView(): View
|
private $viewBuilder;
|
||||||
{
|
|
||||||
$view = View::create();
|
|
||||||
$view->setTemplate(self::TWIG_ENTITY_TEMPLATE_PATH);
|
|
||||||
|
|
||||||
return $view;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ActionHandlerServiceInterface $actionHandlerService
|
* @param ActionHandlerServiceInterface $actionHandlerService
|
||||||
|
* @param TemplateNameServiceInterface $templateNameService
|
||||||
|
* @param ActionTemplateDataStoreServiceInterface $actionTemplateDataStore
|
||||||
|
* @param RequestedActionFormBuilderServiceInterface $requestedActionFormBuilderService
|
||||||
|
* @param RequestedActionServiceInterface $requestedActionService
|
||||||
|
* @param SecureRequestedRightCheckerServiceInterface $secureRequestedRightCheckerService
|
||||||
|
* @param ViewBuilderInterface $viewBuilder
|
||||||
*/
|
*/
|
||||||
public function __construct(ActionHandlerServiceInterface $actionHandlerService, TemplateNameServiceInterface $templateNameService, ActionTemplateDataStoreServiceInterface $actionTemplateDataStore, RequestedActionFormBuilderServiceInterface $requestedActionFormBuilderService, RequestedActionServiceInterface $requestedActionService, SecureRequestedRightCheckerServiceInterface $secureRequestedRightCheckerService)
|
public function __construct(ActionHandlerServiceInterface $actionHandlerService, TemplateNameServiceInterface $templateNameService, ActionTemplateDataStoreServiceInterface $actionTemplateDataStore, RequestedActionFormBuilderServiceInterface $requestedActionFormBuilderService, RequestedActionServiceInterface $requestedActionService, SecureRequestedRightCheckerServiceInterface $secureRequestedRightCheckerService, ViewBuilderInterface $viewBuilder)
|
||||||
{
|
{
|
||||||
$this->actionHandlerService = $actionHandlerService;
|
$this->actionHandlerService = $actionHandlerService;
|
||||||
$this->templateNameService = $templateNameService;
|
$this->templateNameService = $templateNameService;
|
||||||
@ -80,6 +76,7 @@ final class MVCRoutineService implements MVCRoutineServiceInterface
|
|||||||
$this->requestedActionFormBuilderService = $requestedActionFormBuilderService;
|
$this->requestedActionFormBuilderService = $requestedActionFormBuilderService;
|
||||||
$this->requestedActionService = $requestedActionService;
|
$this->requestedActionService = $requestedActionService;
|
||||||
$this->secureRequestedRightCheckerService = $secureRequestedRightCheckerService;
|
$this->secureRequestedRightCheckerService = $secureRequestedRightCheckerService;
|
||||||
|
$this->viewBuilder = $viewBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -113,7 +110,7 @@ final class MVCRoutineService implements MVCRoutineServiceInterface
|
|||||||
$this->actionTemplateDataStore->setData(ActionType::CREATE, $updateForm);
|
$this->actionTemplateDataStore->setData(ActionType::CREATE, $updateForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->getView();
|
return $this->viewBuilder->getView();
|
||||||
}
|
}
|
||||||
throw new \Exception('Not implemented yet!');
|
throw new \Exception('Not implemented yet!');
|
||||||
}
|
}
|
||||||
|
@ -6,27 +6,26 @@ use FOS\RestBundle\View\View;
|
|||||||
use Infinito\Domain\RequestManagement\Action\RequestedActionInterface;
|
use Infinito\Domain\RequestManagement\Action\RequestedActionInterface;
|
||||||
use Infinito\Domain\ActionManagement\ActionServiceInterface;
|
use Infinito\Domain\ActionManagement\ActionServiceInterface;
|
||||||
use Infinito\Domain\ActionManagement\ActionFactoryServiceInterface;
|
use Infinito\Domain\ActionManagement\ActionFactoryServiceInterface;
|
||||||
use Infinito\Domain\ActionManagement\ActionFactoryService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
*/
|
*/
|
||||||
class ViewBuilder implements ViewBuilderInterface
|
final class ViewBuilder implements ViewBuilderInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var View
|
* @var View
|
||||||
*/
|
*/
|
||||||
protected $view;
|
private $view;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var RequestedActionInterface
|
* @var RequestedActionInterface
|
||||||
*/
|
*/
|
||||||
protected $actionService;
|
private $actionService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ActionFactoryServiceInterface
|
* @var ActionFactoryServiceInterface
|
||||||
*/
|
*/
|
||||||
protected $actionFactoryService;
|
private $actionFactoryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ActionServiceInterface $actionService
|
* @param ActionServiceInterface $actionService
|
||||||
@ -43,6 +42,10 @@ class ViewBuilder implements ViewBuilderInterface
|
|||||||
*/
|
*/
|
||||||
public function getView(): View
|
public function getView(): View
|
||||||
{
|
{
|
||||||
|
$view = View::create();
|
||||||
|
$view->setTemplate(self::TWIG_ENTITY_TEMPLATE_PATH);
|
||||||
|
|
||||||
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,6 +10,11 @@ use Infinito\Domain\ActionManagement\ActionServiceInterface;
|
|||||||
*/
|
*/
|
||||||
interface ViewBuilderInterface
|
interface ViewBuilderInterface
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var string The path to the general entity template
|
||||||
|
*/
|
||||||
|
const TWIG_ENTITY_TEMPLATE_PATH = 'entity/entity.html.twig';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return View
|
* @return View
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user