How to fix error in symfony 6 project after renderin

41 Views Asked by At

An exception has been thrown during the rendering of a template ("Symfony\Bridge\Twig\Extension\TranslationExtension::trans(): Argument #1 ($message) must be of type Stringable|Symfony\Contracts\Translation\TranslatableInterface|string|null, array given, called in /home/jcristin/Developments/2024/Pro/c-christin/var/cache/dev/twig/59/599e18f98b2dcab9b681cef22d497244.php on line 1375").

I have this error when i try to render this code in template

private function addNewFieldForCM(FormInterface $form)
    {
        $builder = $form->getConfig()->getFormFactory()->createNamedBuilder(
            'CMfield',
            CollectionType::class,
            null,
            [
                'entry_type' => TextType::class,
                'entry_options' => [
                    'label' => false,
                    'attr' => [
                        'placeholder' => 'Choix'
                    ]
                ],
                'mapped' => false,
                'required' => false,
                'auto_initialize' => false,
                'allow_add' => true,
                'allow_delete' => true,
                'attr' => [
                    'class' => 'md-form'
                ]
            ]
        );
        $form->getParent()->add($builder->getForm());
    }

i upgrade symfony 5 to 6 and i have this error

0

There are 0 best solutions below