Skip to content

Document Twig test "rootform" #10022

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
merged 4 commits into from
Jul 6, 2018
Merged

Document Twig test "rootform" #10022

merged 4 commits into from
Jul 6, 2018

Conversation

yceruto
Copy link
Member

@yceruto yceruto commented Jul 5, 2018

Documents PR symfony/symfony#25236 and closes #8829, sorry for the delay.

@yceruto
Copy link
Member Author

yceruto commented Jul 5, 2018

This is better now, gracias Javier 👍


.. code-block:: twig

{# DON'T DO THIS: this code will fail when the form doesn't have a parent
Copy link
Member Author

Choose a reason for hiding this comment

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

I'd like to rephrase this sentence... since in no case this code will fail because the FormView has a public parent property. The problem appears when you have also defined a parent form field. The last one will have priority for Twig due the array access ability.

I'm not sure how to explain it in short though.

Copy link
Member Author

@yceruto yceruto Jul 5, 2018

Choose a reason for hiding this comment

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

I mean... what you expect for form.parent could change depending on whether your form has or not a parent field. If no: you're checking the parent view, if yes: you're checking the parent field

@yceruto
Copy link
Member Author

yceruto commented Jul 6, 2018

Perfect, thank you!

@javiereguiluz
Copy link
Member

Yonel, thanks for implementing this feature and for providing the docs for it!

@javiereguiluz javiereguiluz merged commit cf355c9 into symfony:2.8 Jul 6, 2018
javiereguiluz added a commit that referenced this pull request Jul 6, 2018
This PR was merged into the 2.8 branch.

Discussion
----------

Document Twig test "rootform"

Documents PR symfony/symfony#25236 and closes #8829, sorry for the delay.

Commits
-------

cf355c9 Reworded the code comments
423bfae Minor reword
740803e Reword
fd433a1 Document Twig test "rootform"
@yceruto yceruto deleted the rootform branch July 6, 2018 11:56
Copy link
Contributor

@HeahDude HeahDude left a comment

Choose a reason for hiding this comment

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

👍

.. code-block:: twig

{# DON'T DO THIS: this simple check can't differentiate between a form having
a parent form view and a form defining a normal form field called 'parent' #}
Copy link
Contributor

Choose a reason for hiding this comment

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

- normal
+ nested

?

Copy link
Member

Choose a reason for hiding this comment

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

fixed in 640e8e5

xabbuh added a commit that referenced this pull request Aug 7, 2018
javiereguiluz added a commit to javiereguiluz/symfony-docs that referenced this pull request Aug 8, 2018
* 3.4:
  Simplified the "Release Process" page
  [Workflow] Fix typo documentation
  Fix mismatched list items
  [symfony#9988] fix minor typos
  [symfony#10099] update XML and PHP config examples
  [symfony#9969] fix a minor typo
  [symfony#10022] fix a minor typo
  preUpdate Event Listener On Uploaded Imagery
  [symfony#10124] fix XML attribute name
  [symfony#10062] fix the code block
  [PHPUnitBridge] Explain how to show stack traces
  Fix docs on trusted hosts
  opcode optimizations
javiereguiluz added a commit to javiereguiluz/symfony-docs that referenced this pull request Aug 8, 2018
* 4.1:
  Simplified the "Release Process" page
  [Workflow] Fix typo documentation
  Fix mismatched list items
  typos in sample code
  [symfony#9988] fix minor typos
  [symfony#10099] update XML and PHP config examples
  [symfony#9969] fix a minor typo
  [symfony#10022] fix a minor typo
  preUpdate Event Listener On Uploaded Imagery
  [symfony#9757] fix rst syntax
  [symfony#10124] fix XML attribute name
  [symfony#10062] fix the code block
  [PHPUnitBridge] Explain how to show stack traces
  Fix docs on trusted hosts
  opcode optimizations
Guikingone pushed a commit to Guikingone/symfony-docs that referenced this pull request Feb 12, 2019
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