-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fixed documentation of collection prototype #1486
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
Conversation
…type') instead of get('prototype')
… getVar('prototype') instead of get('prototype')
... | ||
</ul> | ||
|
||
.. code-block:: html+php | ||
|
||
<ul class="tags" data-prototype="<?php echo $view->escape($view['form']->row($form['tags']->get('prototype'))) ?>"> | ||
<ul class="tags" data-prototype="<?php echo $view->escape($view['form']->row($form['tags']->vars['prototype'])) ?>"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is wrong. For the PHP template, you should document getVar()
. If you want to use the same way than Twig, it would be ->getVars()['prototype']
, but this only wokrs on PHP 5.4 with the array dereferencing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm sorry about that. It was maybe a little too late when I did this…
👍 This PR saved my day |
So finally the correct way to do it in twig is form.tags.vars.prototype isn't it? |
Yes, I am just waiting for the PR to go through |
Fixed documentation of collection prototype
…stent with Symfony 2.1 Both the old and the new syntax work, but due to a BC break in 2.1, only the second is correct in 2.1. To add more consistency between the versions, we're documenting and recommending this change. This relates to #1486
Hey Sébastien! Excellent change! I've also updated the 2.0 branch with the same Twig changes so that we can be consistent, which will be really nice (see sha: 4084a8d) Thanks! |
Excellent, do you think it would be worth mentioning in the upgrade readme ? |
Since symfony/symfony@98a7c0c, collection prototypes are accessed as
form.tags.getVar('prototype')
instead ofform.tags.get('prototype')
.Superseeds PR #1484