Closed atrimech closed 8 years ago
You should be able to add a query_builder
to the options as usual with an form field. May I notice that you are using our old-legacy formextensions bundle? Please take a look at https://github.com/symfony2admingenerator/FormExtensionsBundle on how to update.
Hi @bobvandevijver,
I've try to add this code under options array() :
'query_builder' => function($er) {
return $er->createQueryBuilder('c')
->orderBy('c.position', 'ASC');
},
This is the error:
An exception has been thrown during the rendering of a template ("The option "query_builder" does not exist. Known options are: "action", "allow_extra_fields", "apply_filter", "attr", "auto_initialize", "autocomplete", "block_name", "by_reference", "cascade_validation", "compound", "constraints", "csrf_field_name", "csrf_message", "csrf_protection", "csrf_provider", "csrf_token_id", "csrf_token_manager", "data", "data_class", "data_extraction_method", "disabled", "empty_data", "error_bubbling", "error_mapping", "extra_fields_message", "filter_condition_builder", "help", "inherit_data", "intention", "invalid_message", "invalid_message_parameters", "label", "label_attr", "label_format", "mapped", "max_length", "method", "novalidate", "pattern", "post_max_size_message", "property_path", "read_only", "required", "translation_domain", "trim", "validation_groups", "virtual".")
Yes i'm using the old-legacy formextensions.
Hmm, in that case I'm not sure if it is possible without any custom modifications. Could you post the complete field definition?
Did you try to enable the sortable
option (docs)?
Hi all,
Here is my logs queries dataBase for FormType "afe_collection_upload",![capture d ecran 2015-12-22 a 22 23 31](https://cloud.githubusercontent.com/assets/12831762/11966205/af1a0dd0-a8fa-11e5-997b-ee70da422067.png)
Can i apply an orderBy to view my pictures by order ? If that possible, how can i inject a queryBuilder ?