Generate a context for docgen, on accompanying period

This commit is contained in:
2021-11-30 23:23:02 +01:00
parent 3404d3669c
commit de4e83b3fb
19 changed files with 433 additions and 128 deletions

View File

@@ -14,13 +14,13 @@ namespace Chill\DocGeneratorBundle\Form;
use Chill\DocGeneratorBundle\Context\ContextManager;
use Chill\DocGeneratorBundle\Context\DocGeneratorContextInterface;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
use Chill\DocStoreBundle\Form\StoredObjectType;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Chill\DocStoreBundle\Form\StoredObjectType;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
class DocGeneratorTemplateType extends AbstractType
{
@@ -33,7 +33,7 @@ class DocGeneratorTemplateType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$contexts = \array_flip(\array_map(function (DocGeneratorContextInterface $c) {
$contexts = array_flip(array_map(static function (DocGeneratorContextInterface $c) {
return $c->getName();
}, $this->contextManager->getContext()));
@@ -44,20 +44,19 @@ class DocGeneratorTemplateType extends AbstractType
->add('context', ChoiceType::class, [
'required' => true,
'label' => 'Context',
'choices' => $contexts
'choices' => $contexts,
])
->add('entities', ChoiceType::class, [
'multiple' => true,
'choices' => [
'choices' => [
'AccompanyingPeriod' => 'Chill\PersonBundle\Entity\AccompanyingPeriod',
'SocialWork\SocialAction' => 'Chill\PersonBundle\Entity\SocialWork\SocialAction',
'AccompanyingPeriod\AccompanyingPeriodWorkEvaluation' => AccompanyingPeriodWorkEvaluation::class
]])
'AccompanyingPeriod\AccompanyingPeriodWorkEvaluation' => AccompanyingPeriodWorkEvaluation::class,
], ])
->add('description')
->add('file', StoredObjectType::class, [
'error_bubbling' => true
])
;
'error_bubbling' => true,
]);
}
public function configureOptions(OptionsResolver $resolver)