Skip to content

[Form] Improve form type methods explanation #18585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

HeahDude
Copy link
Contributor

I propose to keep methods ordered the same way they are used by the component:

  • getParent(): a type is first configured by its parent and its parent extensions
  • configureOptions(): a type defines what options are available
  • buildForm(): a type configures the current form and its fields based on defined options
  • buildView(): a type configures its view based on the built form and defined options
  • finishView(): a type configures its child views based on the built form, built view and defined options

@javiereguiluz
Copy link
Member

I'm very glad to merge your improvements to forms docs! Thanks a lot Jules!

@javiereguiluz javiereguiluz merged commit 21f2d8f into symfony:5.4 Jul 20, 2023
@HeahDude HeahDude deleted the improve-form-type-methods-explanation branch July 20, 2023 10:46
nicolas-grekas added a commit to symfony/symfony that referenced this pull request Aug 2, 2023
…ds (HeahDude)

This PR was merged into the 6.4 branch.

Discussion
----------

[Form] Use logical ordering for type and extension methods

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | ~
| License       | MIT
| Doc PR        | symfony/symfony-docs#18585

Related docs PR has already been merged.

IMHO having methods ordered the same way that the component uses them gives a better understanding of how it works (same as having a "supports()" method defined first in a class like `Voter`).

It would be nice to reorder them in core implementations as well, by accepting such changes in 5.4, it would not cause conflicts when merging branches, WDYT?

Commits
-------

40bfbbd [Form][DX] Use logical ordering for type and extension methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants