move logic of context to different interfaces

This commit is contained in:
2021-12-02 18:18:11 +01:00
parent af6efdd0ba
commit be626079d0
7 changed files with 71 additions and 171 deletions

View File

@@ -14,6 +14,7 @@ namespace Chill\DocGeneratorBundle\Controller;
use Base64Url\Base64Url;
use ChampsLibres\AsyncUploaderBundle\TempUrl\TempUrlGeneratorInterface;
use Chill\DocGeneratorBundle\Context\ContextManager;
use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface;
use Chill\DocGeneratorBundle\Context\Exception\ContextNotFoundException;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
use Chill\DocGeneratorBundle\GeneratorDriver\DriverInterface;
@@ -103,7 +104,8 @@ final class DocGeneratorTemplateController extends AbstractController
$contextGenerationData = [];
if ($context->hasPublicForm($template, $entity)) {
if ($context instanceof DocGeneratorContextWithPublicFormInterface
&& $context->hasPublicForm($template, $entity)) {
$builder = $this->createFormBuilder();
$context->buildPublicForm($builder, $template, $entity);
$form = $builder->getForm()->handleRequest($request);