Skip to content

[Form] Added test to show that delete_empty don't work for embedded forms without data_class #22014

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 2 commits into from

Conversation

murilolobato
Copy link

@murilolobato murilolobato commented Mar 15, 2017

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

This pull request creates a test, that fails showing the problem with delete_empty and embedded forms without data_class.

Something needs to be fixed in the ResizeSubscriber or somewhere else that I couldn't find, so this test can pass.

Related to #22008

// form is completely empty
'entry_options' => array('data_class' => null),
'allow_add' => true,
'delete_empty' => true,
Copy link
Member

Choose a reason for hiding this comment

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

Could you add 'allow_delete' => true and try again? (#22008 (comment))

Copy link
Author

Choose a reason for hiding this comment

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

done

@yceruto
Copy link
Member

yceruto commented Mar 15, 2017

(In this use case) A compound form is empty if their children are empty?

  • Yes if data_class is set
  • No if data_class is not set

It is related to data mapper process I think, currently ->isEmpty() depends of how the data was mapped.

@nicolas-grekas nicolas-grekas changed the title [Form] Added test to show that delete_empty don't work for embedded f… [Form] Added test to show that delete_empty don't work for embedded forms without data_class Mar 17, 2017
@nicolas-grekas nicolas-grekas added this to the 2.8 milestone Mar 17, 2017
@fabpot
Copy link
Member

fabpot commented Mar 22, 2017

Thanks for the test. I'm closing the PR as it cannot be merge as is. It will still be referenced in the ticket so that the one working on a fix will have access to it.

@fabpot fabpot closed this Mar 22, 2017
@murilolobato
Copy link
Author

@yceruto made the right appointment. A compound form is empty if their children are empty? Today is: No if data_class is not set. Actually, we can't make a decision now for every future use case.

With this in mind #13601 comes in scene. If we could teach a form how to determine if it is empty, the problem reported here could be solved.

fabpot added a commit that referenced this pull request Jul 26, 2017
…on. (Koc)

This PR was merged into the 3.4 branch.

Discussion
----------

[Form] Allow pass filter callback to delete_empty option.

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #13601, #13940, #22008, #22014
| License       | MIT
| Doc PR        | coming soon

Commits
-------

8630abe [Form] Allow pass filter callback to delete_empty option.
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.

5 participants