⚠ 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

Bug in setDependentRelation when showing multiple fields in setRelation



w.jonker

w.jonker
  • profile picture
  • Member

Posted 09 October 2018 - 14:57 PM

Best,

 

When using the set relation function as followed

 

 
# This is the function that is used to connect two tables with a 1 to n (1:n) relation.
$crud->setRelation('fk_crud_projecten', 'crud_projecten', '{projectnr} - {beschrijving}');
$crud->setRelation('fk_crud_werknemers', 'crud_werknemers', '{voornaam} - {achternaam}');
$crud->setRelation('fk_crud_uitzendbureaus', 'crud_uitzendbureaus', 'naam');
 
# Depended dropdown lists for setRelation (e.g. City dropdown is depended from Country dropdown)
$crud->setDependentRelation('fk_crud_werknemers', 'fk_crud_uitzendbureaus', 'fk_crud_uitzendbureaus');

 

I get the error shown in the attachment of this post. The problem is with

$crud->setRelation('fk_crud_werknemers', 'crud_werknemers', '{voornaam} - {achternaam}');

 

When changing this to the following, to now show multiple field, no error is shown

$crud->setRelation('fk_crud_werknemers', 'crud_werknemers', 'voornaam');

 

The problem is that only the voornaam (first name) is shown,  and achternaam (last name) not anymore. Is there a way to solve this problem with a bug fix, or maybe with a smart trick?

 

Al the best,

Wilfried Jonker


w.jonker

w.jonker
  • profile picture
  • Member

Posted 09 October 2018 - 15:00 PM

I see the screenshot with the eeror is not shown, the output from the error bellow

 

A PHP Error was encountered

Severity: Warning

Message: strstr() expects parameter 1 to be string, array given

Filename: State/StateAbstract.php

Line Number: 768

Backtrace:

File: /opt/ci/application/third_party/GroceryCrudEnterprise/grocerycrud/enterprise/src/GroceryCrud/Core/State/StateAbstract.php
Line: 768
Function: strstr

File: /opt/ci/application/third_party/GroceryCrudEnterprise/grocerycrud/enterprise/src/GroceryCrud/Core/State/StateAbstract.php
Line: 493
Function: getRelationalData

File: /opt/ci/application/third_party/GroceryCrudEnterprise/grocerycrud/enterprise/src/GroceryCrud/Core/State/DatagridState.php
Line: 286
Function: enhanceColumnResults

File: /opt/ci/application/third_party/GroceryCrudEnterprise/grocerycrud/enterprise/src/GroceryCrud/Core/GroceryCrud.php
Line: 2148
Function: render

File: /opt/ci/application/controllers/Database.php
Line: 219
Function: render

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


web-johnny

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

Posted 20 October 2018 - 14:40 PM

Hello @w.jonker

 

I can reproduce the issue and this bug will be fixed as for the next version (2.6.6). I will inform you once this will be available.

 

Regards

Johnny


web-johnny

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

Posted 22 October 2018 - 04:29 AM

Hello @w.jonker,

 

I am glad to inform you that this issue is now fixed as per latest version (2.6.6)  :) 

 

Regards
Johnny

 


w.jonker

w.jonker
  • profile picture
  • Member

Posted 23 October 2018 - 12:22 PM

@johnny

 

Thnx for resolving this issue. I can confirm that it is now working correctly.