Skip to content

Commit

Permalink
bug #5868 Revert the check of the route name (javiereguiluz)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.x branch.

Discussion
----------

Revert the check of the route name

Let's revert #5853 until we can fix the bugs reported in:

* 8e35082#commitcomment-123618904
* #5864

`@inalbilal` I want to fix the bug that you originally reported in #5853, but I think we'll need to use a different fix because some people reported exceptions after applying this change in their applications. Thanks.

Commits
-------

f838349 Revert the check of the route name
  • Loading branch information
javiereguiluz committed Aug 7, 2023
2 parents e258419 + f838349 commit 1aab174
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/Factory/AdminContextFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,9 @@ private function getDashboardDto(Request $request, DashboardControllerInterface
$dashboardControllerRoutes = !file_exists($dashboardRoutesCachePath) ? [] : require $dashboardRoutesCachePath;
$dashboardController = $dashboardControllerInstance::class.'::index';
$dashboardRouteName = null;
$currentRouteName = $request->attributes->get('_route');

foreach ($dashboardControllerRoutes as $routeName => $controller) {
// checking if the route name matches is needed because the same
// dashboard controller can be associated to more than one route
// (see https://github.com/EasyCorp/EasyAdminBundle/pull/5853)
if ($controller === $dashboardController && $currentRouteName === $routeName) {
if ($controller === $dashboardController) {
// if present, remove the suffix of i18n route names (it's a two-letter locale at the end
// of the route name; e.g. 'dashboard.en' -> remove '.en', 'admin.index.es' -> remove '.es')
$dashboardRouteName = preg_replace('~\.\w{2}$~', '', $routeName);
Expand Down

0 comments on commit 1aab174

Please sign in to comment.