Jump to content


setRelationNtoN with where statement after update to v2.8.7

setRelationNtoN where statement

  • Please log in to reply
No replies to this topic

#1 Soreno

Soreno

    Member

  • Members
  • PipPip
  • 15 posts

Posted 13 February 2021 - 05: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?

 







Also tagged with one or more of these keywords: setRelationNtoN, where statement

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users