⚠ 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

Error When Filtering N2N Relationship



Mugs321

Mugs321
  • profile picture
  • Member

Posted 01 July 2018 - 13:40 PM

Can we get some support over here??  Be a week since my first post and have only received one email from @web-johnny.

 

This N2N relationship stuff is completely broken for me now.  Using the out-of-box filters was my last ditch effort to filter down my many-to-many tables (see link for original problem).  

 

Using code below, then filtering on the fieldname, "Game", from the N2N relationship produces this error:

 

( ! ) Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1140 In aggregated query without GROUP BY, expression #2 of SELECT list contains nonaggregated column 'tmp.game_uses_item.ItemInstanceID'; this is incompatible with sql_mode=only_full_group_by' in F:\Programming\Web\FR\www\GroceryCrud\libraries\zendframework\zend-db\src\Adapter\Driver\Pdo\Connection.php on line 360

 

Code:

$crud->setTable('item');
$crud->setSubject('Item', 'Items');

//Define columns and order
$crud->columns(['Game', 'CodeName', 'ImagePath', 'Sound', 'ShortNameLanguageID', 'LongNameLanguageID', 'ItemType']);
$crud->requiredFields(['CodeName', 'ImagePath', 'Sound', 'ShortNameLanguageID', 'LongNameLanguageID', 'ItemType', 'Game']);
$crud->uniqueFields(['CodeName']);
$crud->defaultOrdering('CodeName', 'asc');

//Build relationship between games and items (make sure to hide reference fieldname, will add automatically before add & update)
$crud->setRelationNtoN('Game', 'game_uses_item', 'game', 'ItemID', 'GameID', 'game_shortcode', null);
//$crud->unsetFields(['Game']);

//Convert itemIDs into plain english (filter at end is to limit dropdown list to languages that are used by this game)
$crud->setRelation('ShortNameLanguageID','language','en');
$crud->setRelation('LongNameLanguageID','language','en');

Mugs321

Mugs321
  • profile picture
  • Member

Posted 02 July 2018 - 16:35 PM

This seems to be a config problem with my local MySQL server (WAMP).  Filtering works fine on my prod SQL server.  Support concerns are still relevant.

 

Cheers.


web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 10 July 2018 - 08:39 AM

Hello @Mugs321,
 
 
I am glad that you could find a solution to your problem. For more about the support please read the post that I did create: /topic/4033-callbackcolumns-row-error-undefined-index/#entry15534 I will probably create a sticky post so anyone will know that on the future
 
Regards
Johnny