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

[Form] fix "prototype" not required when parent form is not required #18317

Merged
merged 1 commit into from Apr 5, 2016

Conversation

HeahDude
Copy link
Contributor

Q A
Branch? 2.3+
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #18311
License MIT
Doc PR ~


if ($view->parent && !$view->parent->vars['required']) {
$view->vars['prototype']->vars['required'] = false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

May be a better solution:

$prototype = $form->getConfig()->getAttribute('prototype');
$view->vars['prototype'] = $prototype->setParent($form)->createView($view);

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed! Thanks @sergeyfedotov

@HeahDude
Copy link
Contributor Author

@sergeyfedotov The assertion in your last test looks wrong, "prototype" should not be required in that case, and the test is passing while it's not as expected. I don't think there is a BC break here.

@sergeyfedotov
Copy link
Contributor

Ok. I really don't know should it be interpreted as a BC break or not. But currently entry_options overrides the prototype options and this PR changes the behaviour.

@sergeyfedotov
Copy link
Contributor

@HeahDude
Copy link
Contributor Author

@sergeyfedotov Yes it is, if the parent does not override the prototype options, entry_options should do it.

@HeahDude
Copy link
Contributor Author

Status: Ready

@xabbuh
Copy link
Member

xabbuh commented Apr 5, 2016

👍

Status: Reviewed

@HeahDude
Copy link
Contributor Author

HeahDude commented Apr 5, 2016

Note to the merger: in 2.8 options option in the two tests added needs to be renamed entry_options. Thanks

@fabpot
Copy link
Member

fabpot commented Apr 5, 2016

Thank you @HeahDude.

@fabpot fabpot merged commit 7df9ca2 into symfony:2.3 Apr 5, 2016
fabpot added a commit that referenced this pull request Apr 5, 2016
…t required (HeahDude)

This PR was merged into the 2.3 branch.

Discussion
----------

[Form] fix "prototype" not required when parent form is not required

| Q             | A
| ------------- | ---
| Branch?       | 2.3+
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #18311
| License       | MIT
| Doc PR        | ~

Commits
-------

7df9ca2 [Form] fix "prototype" not required when parent form is not required
@HeahDude HeahDude deleted the bug-prototype_required branch April 5, 2016 16:32
Tobion added a commit that referenced this pull request Apr 6, 2016
This PR was merged into the 2.3 branch.

Discussion
----------

[Form] Remove unnecessary option assignment

| Q             | A
| ------------- | ---
| Branch?       | 2.3
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Option assignment is not required because the prototype inherits this option from the parent form via standard inheritance mechanism.

Related pull requests: #16959, #18317

Commits
-------

da8a197 Remove unnecessary option assignment
This was referenced Apr 29, 2016
@fabpot fabpot mentioned this pull request Apr 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants