symfony / symfony/maker-bundle

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

Open
#472 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.4k
Forks
427
Avg merge
2d 22h
Merged PRs (30d)
20

Description

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' ?>, [
        ])
    ;
}`

Thank you for yours answers.
Have a nice day !

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/Resources/skeleton/crud/form/Type.tpl.php and trace how form_fields and typeOptions are supplied to the template. Reproduce the make:form or make:crud output, then verify that generated fields include the type and options when they are available.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.