mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2024-12-04 23:17:19 +01:00
Optimized view generation process
This commit is contained in:
parent
4a129b172b
commit
13b45b31ae
@ -19,7 +19,6 @@ final class MemberManager implements MemberManagerInterface
|
||||
private $memberRelation;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param MemberRelationInterface $memberRelation
|
||||
*/
|
||||
public function __construct(MemberRelationInterface $memberRelation)
|
||||
@ -28,8 +27,8 @@ final class MemberManager implements MemberManagerInterface
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \Infinito\Domain\MemberManagement\MemberManagerInterface::addMember()
|
||||
*/
|
||||
public function addMember(MemberRelationInterface $member): void
|
||||
@ -41,8 +40,8 @@ final class MemberManager implements MemberManagerInterface
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \Infinito\Domain\MemberManagement\MemberManagerInterface::removeMember()
|
||||
*/
|
||||
public function removeMember(MemberRelationInterface $member): void
|
||||
@ -54,8 +53,8 @@ final class MemberManager implements MemberManagerInterface
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \Infinito\Domain\MemberManagement\MemberManagerInterface::addMembership()
|
||||
*/
|
||||
public function addMembership(MemberRelationInterface $membership): void
|
||||
@ -67,8 +66,8 @@ final class MemberManager implements MemberManagerInterface
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \Infinito\Domain\MemberManagement\MemberManagerInterface::removeMembership()
|
||||
*/
|
||||
public function removeMembership(MemberRelationInterface $membership): void
|
||||
|
@ -5,9 +5,7 @@ namespace Infinito\Domain\MemberManagement;
|
||||
use Infinito\Entity\Meta\Relation\Member\MemberRelationInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
interface MemberManagerInterface
|
||||
{
|
||||
|
@ -65,6 +65,7 @@ final class ProcessService implements ProcessServiceInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Move
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \Infinito\Domain\ProcessManagement\ProcessServiceInterface::process()
|
||||
|
@ -10,7 +10,7 @@ use Infinito\Domain\RequestManagement\Action\RequestedActionServiceInterface;
|
||||
class TemplateNameService implements TemplateNameServiceInterface
|
||||
{
|
||||
/**
|
||||
* @var unknown
|
||||
* @var string
|
||||
*/
|
||||
const BASE_TEMPLATE_DIR = __DIR__.'/../../../templates/';
|
||||
|
||||
@ -136,6 +136,11 @@ class TemplateNameService implements TemplateNameServiceInterface
|
||||
return $this->getTemplatePath(self::MOLECULE_PRAEFFIX);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $template
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function templateExists(string $template): bool
|
||||
{
|
||||
return file_exists(self::BASE_TEMPLATE_DIR.$template);
|
||||
|
@ -6,6 +6,7 @@ use FOS\RestBundle\View\View;
|
||||
use Infinito\Domain\RequestManagement\Action\RequestedActionInterface;
|
||||
use Infinito\Domain\ActionManagement\ActionServiceInterface;
|
||||
use Infinito\Domain\ActionManagement\ActionFactoryServiceInterface;
|
||||
use Infinito\Domain\TemplateManagement\TemplateNameServiceInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@ -27,14 +28,37 @@ final class ViewBuilder implements ViewBuilderInterface
|
||||
*/
|
||||
private $actionFactoryService;
|
||||
|
||||
/**
|
||||
* @var TemplateNameServiceInterface
|
||||
*/
|
||||
private $templateNameService;
|
||||
|
||||
/**
|
||||
* Don't know if this function will be usefull in the future.
|
||||
* Feel free to remove it if this should not be the case.
|
||||
*
|
||||
* @todo Implement tests
|
||||
*
|
||||
* @return string The general entity template or a individual template if it is set
|
||||
*/
|
||||
private function getTemplate(): string
|
||||
{
|
||||
if ($this->templateNameService->doesMoleculeTemplateExist()) {
|
||||
return $this->templateNameService->getMoleculeTemplateName();
|
||||
}
|
||||
|
||||
return self::TWIG_ENTITY_TEMPLATE_PATH;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ActionServiceInterface $actionService
|
||||
* @param ActionFactoryServiceInterface $actionFactoryService
|
||||
*/
|
||||
public function __construct(ActionServiceInterface $actionService, ActionFactoryServiceInterface $actionFactoryService)
|
||||
public function __construct(ActionServiceInterface $actionService, ActionFactoryServiceInterface $actionFactoryService, TemplateNameServiceInterface $templateNameService)
|
||||
{
|
||||
$this->view = new View();
|
||||
$this->view = View::create();
|
||||
$this->actionService = $actionService;
|
||||
$this->templateNameService = $templateNameService;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -42,10 +66,10 @@ final class ViewBuilder implements ViewBuilderInterface
|
||||
*/
|
||||
public function getView(): View
|
||||
{
|
||||
$view = View::create();
|
||||
$view->setTemplate(self::TWIG_ENTITY_TEMPLATE_PATH);
|
||||
$template = $this->getTemplate();
|
||||
$this->view->setTemplate($template);
|
||||
|
||||
return $view;
|
||||
return $this->view;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1 +0,0 @@
|
||||
{{ action_template_data_store_service.getData(action).text }}
|
@ -1 +0,0 @@
|
||||
{{ form(action_template_data_store_service.getData(action)) }}
|
@ -1 +0,0 @@
|
||||
{% extends "entity/source/source.html.twig" %}
|
Loading…
Reference in New Issue
Block a user