Skip to content

[Form] Compound option explained #9283

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

Closed
wants to merge 4 commits into from

Conversation

vudaltsov
Copy link
Contributor

Closes #5213

ping @HeahDude , @wouterj , @xabbuh

Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this change, but I find this description confusing:

The compound option determines whether a form can have children,
in other words is a parent form for other forms.

I don't think both descriptions are equivalent: "can have children" vs "is the parent of other forms". In pseudo-code this would be like canHaveChildren() vs hasChildren(). Both methods are not equivalent. So, what's the most precise description of compound form?

@wouterj
Copy link
Member

wouterj commented Feb 18, 2018

@javiereguiluz I think that's more due to non-nativeness. In the second statement, "is" should be "may" or "can be": In other words, can be a parent form for other forms.

@vudaltsov
Copy link
Contributor Author

Yes, agree, I will fix this. We also discussed a couple of corrections with @HeahDude, I hope to commit them today.

@javiereguiluz
Copy link
Member

@vudaltsov could you please finish this PR? I'd love to merge it. Thanks!

@vudaltsov
Copy link
Contributor Author

@javiereguiluz , does it look better now?
I removed everything I was trying to tell about data in the previous commit. Because it's actually wrong. Compoundness is not about data, it's about the form structure and mostly influences the view, not data.

ping @wouterj , @xabbuh , @HeahDude

Non-compound forms are always leaves in a form tree, they cannot have children.

A non-compound form is rendered as one of the html form elements: ``<input>``
(``TextType``, ``FileType``, ``HiddenType``), ``<textarea>`` (``TextareType``)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: TextareaType

This option specifies if a form is compound. This is independent of whether
the form actually has children. A form can be compound but not have any
children at all (e.g. an empty collection form).
The compound option determines whether a form is compound.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This first phrase looks like a case of circular definition. I think it's better to merge these first phrases into one:

The compound option determines whether a form is compound.
Compound forms are structural elements in a form tree.
Only a compound form can have children, in other words can be a parent for other forms.

Something like this:

If ``true`` this option creates the form as "compound", meaning that it
can contain children and be a parent of other forms.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the introduction to this option I miss some comment about when you should (or should not) set this option to true. In other words, Why/when is this option useful for end-users? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, agree with your comments, hope to find time soon!

@vudaltsov
Copy link
Contributor Author

@javiereguiluz , I feel like I am ready to write an article about this option. Ahahah
I realized that it is one of the clues to understanding the philosophy behind the symfony forms.

@javiereguiluz
Copy link
Member

@vudaltsov thanks for your work on this. After your last changes, even I can fully understand what this option means and why/when should I use it. Thanks!

javiereguiluz added a commit that referenced this pull request Mar 19, 2018
This PR was squashed before being merged into the 2.7 branch (closes #9283).

Discussion
----------

[Form] Compound option explained

Closes #5213

ping @HeahDude , @wouterj , @xabbuh

Commits
-------

977dfb9 [Form] Compound option explained
@vudaltsov vudaltsov deleted the form-compound branch March 30, 2018 00:04
javiereguiluz added a commit that referenced this pull request Dec 8, 2018
This PR was squashed before being merged into the 3.4 branch (closes #10749).

Discussion
----------

[Forms] Improved compound option description

#SymfonyConHackday2018

Corrections for #9283. Thanx a lot to @HeahDude and @javiereguiluz !

Commits
-------

12e9334 [Forms] Improved compound option description
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.

5 participants