⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Issues installing on Symfony 4



NadimD

NadimD
  • profile picture
  • Member

Posted 11 January 2019 - 22:50 PM

Hello there ! :)

 

UPDATED : FOUND SOLUTION !

 

Just to let you know that I kept debugging and found out what was wrong ! :)

I will make a post to let Symfony users know how to install and use the plugin.

 

Remember this block from the examples ?

if ($output->isJSONResponse) {
    header('Content-Type: application/json; charset=utf-8');
    echo $output->output;
    exit;
}

Well in Symfony, I did the following changes, which are WRONG :

return new JsonResponse($output->output);

or

return new JsonResponse(array('output' => $output->output));

What you SHOULD do is the following, as we already have a JSON response, we need to use "fromJsonString" :

if ($output->isJSONResponse) {
	return JsonResponse::fromJsonString($output->output);
}

And that's it ! If you're having trouble, go to the official Grocery CRUD Entreprise website, open the Network tab in the Elements Inspector, refresh and look for the "initial" AJAX call.

Compare the content to the AJAX call you get on your installation. If it doesn't match, something's wrong and that's why GC won't load if everything else is loaded like mentioned bellow in the original post.

 

---

Original post :

 

 

TL;DR :

Plugin loaded into Symfony 4, rendered in a $output variable called in a Twig template, doesn't show anything and I get a JS error.
All ressources are loaded and configurations look good. No error returned. Just divs.

 

 

I purchased the Entreprise Edition, I'm a very old user of GC (since the first version).

 

I followed the steps to install it with composer and I had to adjust a few things in order to make the plugin work. (code is almost similar to Laravel but still needs to be adjusted).

 

The connection to the database works fine, ressources are loaded (JS and CSS), and the $output variable is rendering but everything stays blank, I can't see anything.

 

Looking into the Inspector shows me that the div are generated, the first AJAX call is made and works (the action: initial query), but after that, nothing happens.

 

Still, I'm getting a JS error in the console :

 

 

Uncaught TypeError: Cannot read property 'skin' of undefined

 

Which is located there :

q5AmI4N.png

 

 

When I look into the hidden generated HTML, no columns have been created, so I'm getting nothing.

 

I tried playing with the configurations, one by one. When something's wrong, I get an error.

 

When everything's set properly, I get no error but no result.

 

What would be the cause and what can I do to debug ? I think it's not related to JS. Already tried to remove everything from the page and leave only GC and its loaded CSS/JS files.

Still nothing, the same JS error comes up and I can't figure how to make the plugin work.

 

Once I have figured it out, I will make a post about how to install it on Symfony.

 

Thank you for your time !

Best regards.

 

Edit : Additional info.

Note that while the HTML is rendered and empty, I can see the {{i18n.loading}} line in the following picture. Does that mean it's not rendered properly ?

 

dbLaiuQ.png

 

Symfony uses Twig, not Blade, but I see no reason that would be a problem.