⚠ 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

setRelationNtoN with where statement after update to v2.8.7



Soreno
  • profile picture
  • Member

Posted 13 February 2021 - 17:14 PM

Hello.

Got some problem after update from GCE v2.7.12 to v2.8.7.

I got field 'state' in both tables and for me this stop working

$crud->setRelationNtoN('parent', 'family_parents', 'family', 'id_family', 'id_parent', '{fullname}', null,  ["family.state = '0'"]);

works only in this way

$crud->setRelationNtoN('parent', 'family_parents', 'family', 'id_family', 'id_parent', '{fullname}', null,  ["state = '0'"]);

but I need to use where statement with more complicated criterias in both tables. Controller shows me this error:

 

An uncaught Exception was encountered
Type: PDOException

Message: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'family.state' in 'on clause'

Filename: /web/html/www/application/libraries/GroceryCrudEnterprise/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php

Line Number: 360

Backtrace:

File: /web/html/www/application/libraries/GroceryCrudEnterprise/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php
Line: 360
Function: query

File: /web/html/www/application/libraries/GroceryCrudEnterprise/zendframework/zend-db/src/Adapter/Adapter.php
Line: 190
Function: execute

File: /web/html/www/application/libraries/GroceryCrudEnterprise/grocerycrud/enterprise/src/GroceryCrud/Core/Model.php
Line: 257
Function: query

File: /web/html/www/application/libraries/GroceryCrudEnterprise/grocerycrud/enterprise/src/GroceryCrud/Core/State/StateAbstract.php
Line: 1128
Function: getRelationData

File: /web/html/www/application/libraries/GroceryCrudEnterprise/grocerycrud/enterprise/src/GroceryCrud/Core/State/StateAbstract.php
Line: 1251
Function: getRelationalData

File: /web/html/www/application/libraries/GroceryCrudEnterprise/grocerycrud/enterprise/src/GroceryCrud/Core/State/InitialState.php
Line: 87
Function: getFieldTypes

File: /web/html/www/application/libraries/GroceryCrudEnterprise/grocerycrud/enterprise/src/GroceryCrud/Core/State/InitialState.php
Line: 29
Function: showInitData

File: /web/html/www/application/libraries/GroceryCrudEnterprise/grocerycrud/enterprise/src/GroceryCrud/Core/GroceryCrud.php
Line: 2585
Function: render

File: /web/html/www/application/controllers/Example.php
Line: 280
Function: render

File: /web/html/www/application/controllers/Example.php
Line: 25
Function: example_model

File: /web/html/www/index.php
Line: 315
Function: require_once

CI3 php7.4 MariaDB 10.1

Any suggestions?