-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Find Controller related to Entity to generate admin url #6569
Comments
Do you use pretty URLs added in It you don't, you may use something like this: <a href="{{ path('admin', {
crudAction: 'detail',
crudControllerFqcn: 'App\\Controller\\Admin\\BadgeCrudController',
entityId: entity.instance.entityId,
}) }}">Admin</a> It will require some logic to point to the corresponding controller for each type of entity. With pretty URLs, the URL is simpler: <a href="{{ path('admin_badge_detail', {
entityId: entity.instance.entityId,
}) }}">Admin</a> The word in the middle of the name of the path is the name of the entity. Check the URLs in the admin to see how each entity's name is rendered. |
You're second solution is good but what happen with many entities with same name in differents namespace ? I want to use pretty urls, sure. |
I don't know sorry, you'll have to check the name of the path generated by EasyAdmin. |
Currently, I use
I set my Entity to setController() instead of ControllerFqdn and it works. It's possible to implement same behavior or add something like setEntity() method? |
Can we envisage to have a twig function to find the detail route related to an entity? |
Seems indirectly fix by 8efaa68 |
I have a tool which log event for every entities. On my entity Log, I have fields EntityClass and EntityId.
Is there a way to find controller related to entity in twig to use it like this?
The text was updated successfully, but these errors were encountered: