maker-bundle icon indicating copy to clipboard operation
maker-bundle copied to clipboard

make:form and make:crud don't inject typeFields of entity in form's template

Open Nico2i opened this issue 4 years ago • 6 comments

Good morning !

I want to automate more my developments in Symfony 4. For that, I wanted to fork the maker-bundle and inject in the template Type.tpl.php the typeFields. However, this is already coded but the result is always : ->add('myAttibute') and not ->add('myAttibute', fieldType::class, ...) However, there are this lines in the code (src/Resources/skeleton/crud/form/Type.tpl.php):

` public function buildForm(FormBuilderInterface $builder, array $options) { $builder

$typeOptions): ?>
        ->add('<?= $form_field ?>')
        ->add('<?= $form_field ?>', <?= $typeOptions['type'] ?>::class)
        ->add('<?= $form_field ?>', <?= $typeOptions['type'] ? ($typeOptions['type'].'::class') : 'null' ?>, [
= $typeOptions['options_code']."\n" ?>
        ])
    ;
}`

Thank you for yours answers. Have a nice day !

Nico2i avatar Sep 17 '19 07:09 Nico2i

Nice issue description @ruifpedro! Thank you.

I'll tag some folks with more knowledge about that feature: @betodealmeida @eschutho @rusackas

michael-s-molina avatar Feb 28 '24 15:02 michael-s-molina

Hello @ruifpedro thank you for detailed explanation. It helped us as well.

ilndinesh avatar Mar 06 '24 11:03 ilndinesh

Hello @ruifpedro , Your detailed explanation helped us figure out that checking the "enable row expansion" is causing the dashboard import error in the same instance and different instance, we fixed it by writing code to stop schema options keys from going into the export zip. we noticed that we are unable to uncheck the "enable row expansion" using GUI and we used curl to uncheck it. Many Thanks once again and hope this helps others as well. Good day

lokeshwar9 avatar Mar 07 '24 06:03 lokeshwar9

@ruifpedro do you manage to solve the issue?i get the same issue how can i fix it?

marituhone avatar Apr 25 '24 07:04 marituhone

Hello @ruifpedro , Your detailed explanation helped us figure out that checking the "enable row expansion" is causing the dashboard import error in the same instance and different instance, we fixed it by writing code to stop schema options keys from going into the export zip. we noticed that we are unable to uncheck the "enable row expansion" using GUI and we used curl to uncheck it. Many Thanks once again and hope this helps others as well. Good day

I've missed your comment! Yes that it's the case, I'm also unable to uncheck the "enable row expansion" option.

ruifpedro avatar Apr 25 '24 07:04 ruifpedro

@ruifpedro do you manage to solve the issue?i get the same issue how can i fix it?

As my first post states, I've managed to circumvent the problem by simply, exporting the dashboard, opening up the zip and modifying the respective database yaml to manually remove the extra.schema_options key and values. Zip the contents and then you have a valid set of assets that can be imported.

ruifpedro avatar Apr 25 '24 08:04 ruifpedro