Easyadminbundle: Route generation in EasyAdmin 3.0

Created on 17 Aug 2020  路  2Comments  路  Source: EasyCorp/EasyAdminBundle

I'm trying to generate the detail route for an entity in a twig file with this code:

{{ path('admin', { crudAction: 'detail', entity: 'Client', entityId: client.id }) }}

but it moves me to the root dashboard page. I noticed that if I insert manually also crudId, copying it from another route, it works. But how can I find the crudId for the detail action when I'm in a twig file?

Most helpful comment

EasyAdmin has a twig helper function for that:

{% set url = ea_url()
    .setDashboard('App\\Controller\\Admin\\DashboardController')
    .setController('App\\Controller\\Admin\\ClientCrudController')
    .setAction('detail') %}

Docs here:
https://symfony.com/doc/current/bundles/EasyAdminBundle/crud.html#generating-crud-urls

All 2 comments

EasyAdmin has a twig helper function for that:

{% set url = ea_url()
    .setDashboard('App\\Controller\\Admin\\DashboardController')
    .setController('App\\Controller\\Admin\\ClientCrudController')
    .setAction('detail') %}

Docs here:
https://symfony.com/doc/current/bundles/EasyAdminBundle/crud.html#generating-crud-urls

Thanks, it works

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BigMichi1 picture BigMichi1  路  3Comments

joazvsoares picture joazvsoares  路  4Comments

devkbsc picture devkbsc  路  3Comments

Ealenn picture Ealenn  路  3Comments

javiereguiluz picture javiereguiluz  路  4Comments