Skip to content

EasyAdmin pretty URLs forcing unique controller names #7096

@janklan

Description

@janklan

Describe the bug

Enabling the pretty URLs breaks the function with the following error:

When using pretty URLs, all CRUD controllers must have unique PHP class names to generate unique route names. However, your application has at least two controllers with the FQCN "App\Controller\Admin\TaskCrudController", generating the route "admin_task_index". Even if both CRUD controllers are in different namespaces, they cannot have the same class name. Rename one of these controllers to resolve the issue in . (which is being imported from "/app/config/routes/easyadmin.yaml"). Make sure there is a loader supporting the "easyadmin.routes" type.

To Reproduce

Re-use a Controller name in two separate namespaces


I'm reporting this as a bug, because I think there is no reason for EasyAdmin to force a globally unique class name upon us. That's why the namespaces were created in the first place.

If the namespace can't be part of the automatic route name, allow the controller to define its own (unique) route prefix to work around this issue.

Or is there any real reason for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions