Sonataadminbundle: sonata_type_choice_field_mask empty_value throw exception

Created on 15 Mar 2017  Â·  13Comments  Â·  Source: sonata-project/SonataAdminBundle

Trying to use sonata_type_choice_field_mask as define in the documentation https://sonata-project.org/bundles/admin/3-x/doc/reference/form_types.html

The property empty_value seems to not be surported anymore, I get this error.

The option "empty_value" does not exist. Defined options are: "action", "allow_extra_fields", "attr", "auto_initialize", "block_name", "by_reference", "choice_attr", "choice_label", "choice_loader", "choice_name", "choice_translation_domain", "choice_value", "choices", "choices_as_values", "compound", "constraints", "csrf_field_name", "csrf_message", "csrf_protection", "csrf_token_id", "csrf_token_manager", "data", "data_class", "disabled", "empty_data", "error_bubbling", "error_mapping", "expanded", "extra_fields_message", "group_by", "horizontal_input_wrapper_class", "horizontal_label_class", "horizontal_label_offset_class", "inherit_data", "invalid_message", "invalid_message_parameters", "label", "label_attr", "label_format", "label_render", "map", "mapped", "method", "multiple", "placeholder", "post_max_size_message", "preferred_choices", "property_path", "required", "sonata_admin", "sonata_field_description", "sonata_help", "sortable", "translation_domain", "trim", "upload_max_size_message", "validation_groups".

Most helpful comment

let me cd ~/dev/symfony-docs and do git log -S empty_value -p

All 13 comments

Maybe it should be placeholder ? http://symfony.com/doc/current/reference/forms/types/choice.html#placeholder ? Or empty_data

This add a new choice :(

What about empty_data? Not sure what you are trying to do btw…

In fact I wanted to add a kind of placeholder and I assume this is what empty_value was for.
Anyway if I opened this issue it's more to notice this error from the doc more than to get a solution :)

So… placeholder doesn't do just that? If it does, can you make a PR to fix the docs?

I can just delete the empty_value reference since I don't know what it did

let me cd ~/dev/symfony-docs and do git log -S empty_value -p

The placeholder option was introduced in Symfony 2.6 and replaces empty_value, which is available prior to 2.6.

So you can purely and simply replace empty_value with placeholder, and if you do, please grep for it in the entire repo.

ok I will

Thanks a lot for contributing!

I don't think so, b/c it will break projects of sf 2.3 users. Should be done on master though.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peter-gribanov picture peter-gribanov  Â·  3Comments

parijathakumar picture parijathakumar  Â·  3Comments

ajeetvarma picture ajeetvarma  Â·  3Comments

kiler129 picture kiler129  Â·  3Comments

core23 picture core23  Â·  4Comments