Jump to content


Member Since 11 Jan 2019
Offline Last Active Mar 28 2019 07:20 PM

Topics I've Started

Question about the docs for setModel

13 January 2019 - 11:29 PM

Hello John :)


I was reading the docs (Entreprise Edition) about callbackColumn here : https://www.groceryc.../callbackColumn


And I'm facing the problem you talk about. Making a custom column affects the search function and it won't work properly.

What did you mean when you said to use a setModel ? I don't see how you would use a Model in this case !


Could you tell me more ? Thanks ! :)


Update : I did a patch in order to make the search function work with a relation and its custom fields.

I will release it if you agree, but since it is Entreprise Edition, please let me know what to do with the patch.


That's how it works now, first I can search as always in a non related field, and I can make a callback on the column "page_id" with the name "Page associée" displayed here :





And I can type in multiple words, multiple "like" queries will be added to the whereStatements function and explode each keyword typed to give this result :




Also, spaces will be ignored so that you can make a copy&paste without worrying about formatting the text.

Entreprise : Issue found with setRelation and bracets (solution found)

12 January 2019 - 01:31 AM



Just to let you know that using multiple fields with setRelation as the following doesn't work with 2.6.11 :

$crud->setRelation('admin_id', 'users', '{id} - {first_name} {last_name}');

Error given in AJAX request :

Warning: strstr() expects parameter 1 to be string, array given in :
\vendor/grocerycrud/enterprise/src/GroceryCrud/Core/State/StateAbstract.php (line 954)

Problem is an array is given to strstr. This array contains :

  • id
  • first_name
  • last_name


My workaround was to add this at before the return in the function hasMultipleFields :

    	$titleField = implode($titleField);

Please let me know if you don't want me to publish the name of your functions like I just did. I did it in order to help you maintain your plugin because I love it and want to help !


Best regards

Issues installing on Symfony 4

11 January 2019 - 10:50 PM

Hello there ! :)




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;

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

return new JsonResponse($output->output);


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 :




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 :




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 ?




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