Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 6 commits into from
Jul 3, 2012
Merged

Fixed documentation of collection prototype #1486

merged 6 commits into from
Jul 3, 2012

Conversation

lavoiesl
Copy link
Contributor

Since symfony/symfony@98a7c0c, collection prototypes are accessed as form.tags.getVar('prototype') instead of form.tags.get('prototype').

Superseeds PR #1484

...
</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'])) ?>">
Copy link
Member

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

Copy link
Contributor Author

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…

@romainneutron
Copy link
Contributor

👍 This PR saved my day

@arnaugm
Copy link

arnaugm commented Jun 28, 2012

So finally the correct way to do it in twig is form.tags.vars.prototype isn't it?
The documentation in the web page is not updated yet right? because I still see get('prototype')

@lavoiesl
Copy link
Contributor Author

Yes, I am just waiting for the PR to go through

weaverryan added a commit that referenced this pull request Jul 3, 2012
Fixed documentation of collection prototype
@weaverryan weaverryan merged commit 3b570ea into symfony:master Jul 3, 2012
weaverryan added a commit that referenced this pull request Jul 3, 2012
…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
@weaverryan
Copy link
Member

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!

@lavoiesl
Copy link
Contributor Author

lavoiesl commented Jul 3, 2012

Excellent, do you think it would be worth mentioning in the upgrade readme ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants