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

Appearance settings

[Form] getParent() does not receive correct options array #25

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

Closed
wants to merge 0 commits into from

Conversation

Burgov
Copy link

@Burgov Burgov commented Apr 5, 2012

I wrote two tests which show exactly what functionality was broken by PR symfony#3290. Unfortunately one of them (testChildDefaultOptionIsPassedToChildsGetParentMethod) is still broken after PR symfony#3789.

The default options of children or even the type itself are still not passed to the getParent method, forcing users to pass these options to the factory every time they use the type. A more specific use case is when you create a type which has "choice" as it's parent. When in its default options it defines "expanded"=>true and "multiple"=>true, the getParent() of the "choice" type should always return "form", otherwise a dataMapper will never be assigned and the checkbox list shows empty, even if some values are "true".

At this moment the getParent method reads as follows:

public function getParent(array $options)
{
    return isset($options['expanded']) && $options['expanded'] ? 'form' : 'field';
}

If the option was not passed to the factory (e.g. from the controller), it seems to just assume the form is not "expanded", which sounds wrong to me.

Hopefully this test can help fix the problem!

@webmozart
Copy link
Owner

Thank you for the PR. Unfortunately there is no way this could ever work. In order to determine the specific options used to instantiate a form, you'd have to know the complete inheritance tree. So you cannot know the options when building the tree. I'm starting to think that this whole dynamic inheritance thing is flawed.

@webmozart
Copy link
Owner

On a side note, please try to name PRs and tickets in a meaningful way. This makes our lives much easier :) I changed the name of this PR now.

@webmozart
Copy link
Owner

Ah, I just noticed that you opened this PR in my repository. Please reopen it in the symfony/symfony repository in order to make it visible for other collaborators as well. Usually we don't deal with issues or PRs in collab repos.

@webmozart webmozart closed this Apr 5, 2012
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.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.