Open makoso opened 7 years ago
Hi,
could you explain this? When _route
is not available?
Hi @DonCallisto
I get this error when i need grid on page that has route parameters and grid isnt returned by gridGet reponse, because ineed more that one grid on this page i return it like this example:
if i dont have this changes i get error unable to generate route for name ""(empty) or in some times i get error of missing parameters to gereate route for current request (i use ajax) after this fix #967 i get good grid displayed but no working filtering because there is same problem, request dosnt contains all parameters see #968
Maybe is better to check it in constructor?
Regards.
Sorry but I don't understand your use case. Do you have multiple grid on the same page?
If page is the same, _route
and other things should continue to work as expected.
Can you isolate the problem in a repository so we can see exactly what's going on? To me is just strange that no route is setted.
@DonCallisto this actually happens on forwarded routes.
Fabien Potencier actually explained here that _route should not be used because it is only for debugging purpose.
In a similar issue, I did resolve it using the RequestStack instead:
/** @var Symfony\Component\HttpFoundation\RequestStack $requestStack -- can be DI'ed */
$gridManager->createGrid()
->setSource($source)
->setRouteUrl($requestStack->getMasterRequest()->getPathInfo());
That makes sense but we should think how to solve this natively. I'll take a look when I have time otherwise feel free to open a PR.
Fix error on requests that cannot access requested _route