8000 Added caution block under delete_empty to warn the developer when he try to activate delete_empty for collections of compound forms by murilolobato · Pull Request #7767 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Added caution block under delete_empty to warn the developer when he try to activate delete_empty for collections of compound forms #7767

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

Merged
merged 5 commits into from
Jul 21, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added caution block under delete_empty to warn the developer when he …
…try to activate delete_empty

for collections of compound forms.
  • Loading branch information
murilolobato committed Apr 7, 2017
commit b9e375c0a98cfb02feb011e7e49ed56dc1fecc45
7 changes: 7 additions & 0 deletions reference/forms/types/collection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,13 @@ delete_empty

**type**: ``Boolean`` **default**: ``false``

.. caution::
Copy link
Contributor

Choose a reason for hiding this comment

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

The block should be added after the description.


Delete empty will only remove items when the normalized value is null.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would either say:

The ``delete_empty`` option will...

or "This option will ...".

If your `type`_ is a compound form type, you need to have the :ref:`required <reference-form-option-required>`
option set to ``false`` inside `options`_, See :ref:`empty_data <reference-form-option-empty-data>`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add:

or ``empty_data`` option explicitly set to null.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could also mention that the required or empty_data options can be defined as entry_options of the CollectionType, not necessarily in the nested type class itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the above text, when I mean 'options' I'm referring to 'entry_options', it is because I'm making the pull request to syfmony 2.7.

Copy link
Contributor

Choose a reason for hiding this comment

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

"inside options" could be removed, but let's wait for other reviewers opinion before rewording it.



If you want to explicitly remove entirely empty collection entries from your
form you have to set this option to true. However, existing collection entries
will only be deleted if you have the allow_delete_ option enabled. Otherwise
Expand Down
2 changes: 2 additions & 0 deletions reference/forms/types/form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ option on the form.

.. include:: /reference/forms/types/options/data_class.rst.inc

.. _reference-form-option-empty-data:

.. include:: /reference/forms/types/options/empty_data.rst.inc
:end-before: DEFAULT_PLACEHOLDER

Expand Down
0