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

@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\DocGeneratorBundle\Form;
use Chill\DocGeneratorBundle\Context\ContextManager;
use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithAdminFormInterface;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
use Chill\DocStoreBundle\Form\StoredObjectType;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
@@ -44,7 +45,8 @@ class DocGeneratorTemplateType extends AbstractType
'error_bubbling' => true,
]);
if ($context->hasAdminForm()) {
if ($context instanceof DocGeneratorContextWithAdminFormInterface
&& $context->hasAdminForm()) {
$sub = $builder
->create('options', null, ['compound' => true])
->addModelTransformer(new CallbackTransformer(