Here we will see how to create a second interface while the entity is already in use in a CRUD interface.
The problem with automatically generated interfaces is that they use the name of the entity to construct the routes.
If we configure a second interface with an entity that is already used, we will end up with the same route as the first.
To address this issue, we will use these two parameters in our admin class to override the default values.
Suppose we are using the entity "model", we could use the term "model2" (or toto, whatever you actually want)
protected $baseRouteName = 'admin_vendor_app_modele2';
protected $baseRoutePattern = 'modele2';
Do not forget to clear the cache properly so that the new routes are taken into account.
Adapt the example to the installed version
The Symfony and Sonata examples remain tied to the versions indicated in the article. Symfony 4.x and Symfony 6.2 are no longer maintained: for a current project, use a maintained branch and the documentation that exactly matches your dependencies.
php bin/console about
composer show symfony/framework-bundle sonata-project/admin-bundle
Before resuming the code, check the signatures, services, routes, and templates concerned. Then add a functional test covering permissions, HTTP code, and the visible result.
Reference: maintained Symfony versions.