symfony / symfony/maker-bundle
make:form and make:crud don't inject typeFields of entity in form's template
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
->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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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