Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged

Conversation

@HeahDude
Copy link
Contributor

QA
Branch2.8+
New docfinishes#4367

@HeahDudeHeahDudeforce-pushed thefix/form_type-prototype_data_option branch 2 times, most recently frombefaeb4 to6f15771CompareApril 9, 2016 13:57

**type**: ``mixed`` **default**: ``null``

Allows you to define a specific data for the prototype. Each new row added will
Copy link
Member

Choose a reason for hiding this comment

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

[...] define specific data [...]

@xabbuh
Copy link
Member

We need aversionadded directive for this option.

HeahDude reacted with thumbs up emoji

use Symfony\Component\Form\Extension\Core\Type\TextType;
$builder->add('tags', CollectionType::class, array(
'class' => \AppBundle\Entity\Tag::class,
Copy link
Member

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.

HeahDude reacted with thumbs up emoji
@HeahDudeHeahDudeforce-pushed thefix/form_type-prototype_data_option branch from6f15771 to1b5e46eCompareApril 11, 2016 09:03
@HeahDude
Copy link
ContributorAuthor

@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;
Copy link
Member

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. :)

HeahDude reacted with laugh emoji
Copy link
ContributorAuthor

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!

@HeahDudeHeahDudeforce-pushed thefix/form_type-prototype_data_option branch from1b5e46e to2034e96CompareApril 11, 2016 09:26
@xabbuh
Copy link
Member

👍

// ...

$builder->add('emails', CollectionType::class, array(
$builder->add('emails', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array(
Copy link
Member

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?

Copy link
ContributorAuthor

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 :)

Copy link
Member

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.

Copy link
ContributorAuthor

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 :)

@HeahDudeHeahDudeforce-pushed thefix/form_type-prototype_data_option branch from2034e96 to3c08e10CompareApril 13, 2016 06:55
// ...
$builder->add('tags', CollectionType::class, array(
'class' => 'AppBundle\Entity\Tag',
Copy link
ContributorAuthor

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 ?

Copy link
Member

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?

Copy link
ContributorAuthor

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 :)

Copy link
Member

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?

Copy link
ContributorAuthor

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.

@HeahDudeHeahDudeforce-pushed thefix/form_type-prototype_data_option branch from3c08e10 to95bda57CompareApril 14, 2016 16:57
@HeahDude
Copy link
ContributorAuthor

Ok should be good now.

xabbuh reacted with hooray emoji

@xabbuh
Copy link
Member

Cool 👍

HeahDude reacted with laugh emoji

@wouterjwouterj merged commit95bda57 intosymfony:2.8Apr 18, 2016
wouterj added a commit that referenced this pull requestApr 18, 2016
…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 added a commit that referenced this pull requestApr 18, 2016
@wouterj
Copy link
Member

Thanks for your work on this@HeahDude and@kgilden! It's finally merged now.

Fyi, I've added a reference to the entry_options setting in326ae53.

@HeahDude
Copy link
ContributorAuthor

Nice addition, thank you@wouterj! Also thanks to@kgilden@xabbuh

@HeahDudeHeahDude deleted the fix/form_type-prototype_data_option branchApril 18, 2016 21:31
wouterj added a commit to wouterj/symfony-docs that referenced this pull requestApr 20, 2016
wouterj added a commit that referenced this pull requestApr 20, 2016
wouterj added a commit that referenced this pull requestApr 20, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@HeahDude@xabbuh@wouterj@weaverryan@kgilden

[8]ページ先頭

©2009-2025 Movatter.jp