Skip to content

Commit 94dc0cd

Browse files
committed
Fix getting entityId when using mapped route attributes
1 parent 640e870 commit 94dc0cd

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/Factory/ControllerFactory.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace EasyCorp\Bundle\EasyAdminBundle\Factory;
44

55
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
6+
use EasyCorp\Bundle\EasyAdminBundle\Config\Option\EA;
67
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Controller\CrudControllerInterface;
78
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Controller\DashboardControllerInterface;
89
use Symfony\Component\HttpFoundation\Request;
@@ -39,6 +40,9 @@ private function getDashboardController(?string $dashboardControllerFqcn, Reques
3940

4041
private function getCrudController(?string $crudControllerFqcn, ?string $crudAction, Request $request): ?CrudControllerInterface
4142
{
43+
if (isset($request->attributes->get('_route_params')[EA::ENTITY_ID]) && !$request->attributes->has(EA::ENTITY_ID)) {
44+
$request->attributes->set(EA::ENTITY_ID, $request->attributes->get('_route_params')[EA::ENTITY_ID]);
45+
}
4246
return $this->getController(CrudControllerInterface::class, $crudControllerFqcn, $crudAction, $request);
4347
}
4448

0 commit comments

Comments
 (0)