Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
[Form] added prototype_data option in CollectionType#6450
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[Form] added prototype_data option in CollectionType#6450
Uh oh!
There was an error while loading.Please reload this page.
Conversation
befaeb4 to6f15771Comparereference/forms/types/collection.rst Outdated
| **type**: ``mixed`` **default**: ``null`` | ||
| Allows you to define a specific data for the prototype. Each new row added will |
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.
[...] define specific data [...]
xabbuh commentedApr 11, 2016
We need a |
reference/forms/types/collection.rst Outdated
| use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
| $builder->add('tags', CollectionType::class, array( | ||
| 'class' => \AppBundle\Entity\Tag::class, |
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.
For the Symfony 2.8 docs we always use a string to be compatible with PHP 5.3 and 5.4.
6f15771 to1b5e46eCompareHeahDude commentedApr 11, 2016
@xabbuh Thanks for the review, comments addressed. |
| ..code-block::php | ||
| use Symfony\Component\Form\Extension\Core\Type\CollectionType; | ||
| use Symfony\Component\Form\Extension\Core\Type\TextType; |
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.
The use statements are useless now. :)
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.
Right, I made another commit to do that change in all examples, so you can easily revert it in 3.0+ branches. Thanks!
1b5e46e to2034e96Comparexabbuh commentedApr 11, 2016
👍 |
reference/forms/types/collection.rst Outdated
| // ... | ||
| $builder->add('emails', CollectionType::class, array( | ||
| $builder->add('emails', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array( |
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.
Why the change away from theCollectionType::class? That option (with::class)seems a little easier because we can use IDE auto-completion. Or have we been changing this elsewhere?
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.
@weaverryan, the discussion with@xabbuh is on the outdated diff:#6450 (comment)
Because 2.8 supports PHP < 5.5, I made a different commit for those changes so it can be reverted in 3.0.
Thanks :)
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.
@HeahDude It looks like I was mistaken here and we at some point agreed on using theclass constant even in the 2.8 docs (seehttp://symfony.com/doc/2.8/book/forms.html, for example). Sorry for the confusion.
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.
@xabbuh No worry, I just removed the last commit :)
2034e96 to3c08e10Comparereference/forms/types/collection.rst Outdated
| // ... | ||
| $builder->add('tags', CollectionType::class, array( | ||
| 'class' => 'AppBundle\Entity\Tag', |
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.
@xabbuh, I intentionally didn't change this one since it's almost the same:'AppBundle\Entity\Tag' VS\AppBundle\Entity\Tag::class unless we add a use statement:
useAppBundle\Entity\Tag;// ...'class' => Tag::class
What do you like ?
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.
Actually, I was a bit confused and I am even more confused now. Where from did you take theclass option?
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.
My bad, confusion withEntityType!Should beentry_typedata_class inentry_options, I'll just remove it :)
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.
Oh okay, butentry_type is already set to refer to theTextType, isn't it?
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.
Yes I answered too quickly and edited it.
3c08e10 to95bda57CompareHeahDude commentedApr 14, 2016
Ok should be good now. |
xabbuh commentedApr 14, 2016
Cool 👍 |
…gilden, HeahDude)This PR was merged into the 2.8 branch.Discussion----------[Form] added prototype_data option in CollectionType| Q | A ||----|----|| Branch | 2.8+ || New doc | finishes#4367 |Commits-------95bda57 [Form] defined default and added example CollectionType `prototype_data` optione18dc1f [Form] Document CollectionType's `prototype_data`
wouterj commentedApr 18, 2016
HeahDude commentedApr 18, 2016
…Type (kgilden, HeahDude)