Skip to content
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

HorizontalFormTypeExtension doesn’t play well with CollectionType in latest Symfony stable #1167

Closed
corphi opened this issue May 3, 2016 · 8 comments

Comments

@corphi
Copy link
Contributor

corphi commented May 3, 2016

With symfony/symfony#18317 collection form prototypes have their parent set, but there is no inverse direction, i.e. the prototype is not part of the collection children.

HorizontalFormTypeExtension sets the horizontal view variable on root forms and bubbles its value to the form children. As prototypes are no longer root forms, their value stays null and evaluates to false in the template.

@rejsmont
Copy link
Contributor

Current workaround is to set 'horizontal' => true for each child, though this is not clean and optimal solution. Also there is a duplicate issue #1176.

@MichaelMure
Copy link

Hi, I described my problem in Symfony's issues (symfony/symfony#19355) and a dev suggested that it could be an usage error by MopaBootsrap (symfony/symfony#19355 (comment))

Can someone experienced here have a look on the issue ?

@HeahDude
Copy link

Hi there, I confirm that a prototype should not be considered as a root form.

It used to work because of a kind of bug in the prototype creation from CollectionType, is there anyway you can fix it in your code? Thanks.

@isometriks
Copy link
Collaborator

@HeahDude can you try my PR?

#1180

Check here to grab it if you don't know how: https://help.github.com/articles/checking-out-pull-requests-locally/

I just added a bunch more tests. I think it should be working properly now.

@HeahDude
Copy link

@isometriks thanks for taking care of this issue :)

Actually I don't use this lib, I was just saying that this "regression" is a bug fix on symfony side so it should be fix on "this" side. Thanks again, cheers!

@isometriks
Copy link
Collaborator

Ah ok, thanks!

@isometriks
Copy link
Collaborator

@corphi @rejsmont @MichaelMure I think I've solved this, try out v3.1.0 and let me know if you have better luck. You shouldn't have to set horizontal on all children anymore.

@MichaelMure
Copy link

It does work for me, thanks !

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

No branches or pull requests

5 participants