i18n issue with Pretty URLs; legacy URLs work as expected
We have a weird bug for some of our URLs.
For example, this is how we generate URLs internally:
private function generateProvisionUrl(Server $entity): string
{
return $this->urlGenerator->generate('admin.provisioning.form', [
'id' => $entity->getId(),
], UrlGeneratorInterface::ABSOLUTE_URL);
}
This generates a pretty URL, which is fine in most cases. However, especially for "custom" pages, we have issues with these pages when the URL is pretty.
Error:
Impossible to access an attribute ("i18n") on a null variable in @EasyAdmin/layout.html.twig at line 3.
We do extend the templates like this:
{% extends '@EasyAdmin/page/content.html.twig' %}
However, this URL works just perfectly fine:
/admin?routeName=admin.hetzner.project
But it will fail when we call the pretty url: /admin/hetzner/project
Sadly I weren't able to find out why. We are probably extending incorrectly, but we have a few hundreds of pages that work like this perfectly fine, prevent us from upgrading fully to the pretty URLs.
Any help is appreciated for this matter. 🙏🏻
After using AdminRoute instead of classic Route as controller declarations, the problem has been solved for me.