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