Skip to content

Fix getting entityId when using mapped route attributes#7495

Open
jacekkow wants to merge 1 commit intoEasyCorp:5.xfrom
jacekkow:5.x
Open

Fix getting entityId when using mapped route attributes#7495
jacekkow wants to merge 1 commit intoEasyCorp:5.xfrom
jacekkow:5.x

Conversation

@jacekkow
Copy link
Contributor

@jacekkow jacekkow commented Mar 9, 2026

When using mapped attributes (i.e. entityId becoming order.id like in the example below) entity instance is not properly set inside AdminContext.

        #[AdminRoute('/{entityId:order.id}/invoice')]
        public function renderInvoice(Order $order, AdminContext $context): Response {
            $context->getEntity()->getInstance(); // is null!
        }

This is because entityId is no longer a route attribute, order.id is.

Fix this by trying to fetch original entityId value from _route_params.

Related to #7488

@jacekkow jacekkow changed the title Set entity instance in AdminContext when using mapped route attributes Fix getting entityId when using mapped route attributes Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant