Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error empty route name #967

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix error empty route name #967

wants to merge 1 commit into from

Conversation

makoso
Copy link

@makoso makoso commented Jul 28, 2017

Fix error on requests that cannot access requested _route

Fix error on requests that cannot access requested _route
@makoso makoso mentioned this pull request Jul 28, 2017
@DonCallisto
Copy link
Member

Hi,
could you explain this? When _route is not available?

@makoso
Copy link
Author

makoso commented Jul 28, 2017

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:

  1. Create grid
  2. fire method isReadyForRedirect()
  3. assign to the template
  4. standard render it:
    {{ grid(contactPersons, 'APYDataGridBundle::blocks_js.jquery.html.twig') }}

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.

@DonCallisto
Copy link
Member

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.

@b-enoit-be
Copy link

@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.

@b-enoit-be
Copy link

b-enoit-be commented Sep 19, 2018

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());

@DonCallisto
Copy link
Member

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.

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.

3 participants