Search code examples
symfonysonata

Sonata admin dashboard action with parameters


    groups:
        panel:
            items:
                -   route: 'admin_app_order_list' 
                    route_params: { filter: { group: { value: 'active' } } }
                    label: test

get

Invalid type for path "sonata_admin.dashboard.groups.panel.items.0.route_params.filter". Expected "scalar", but got "array".

why params filter require string ? possible to fix this ?


Solution

  • Using route_params requires an array with key/values, where values should be strings:

        route_params: { filter: "group[value]=active" }
    

    Keep in mind, using % will be interpreted by Symfony's Config component. If you're gonna use them, you need to escape them by using %% (twice).