⚠ 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 doesn't work anymore with 2.3.4



cletourneau
  • profile picture
  • Member

Posted 06 October 2017 - 15:32 PM

Hi,

 

I have an N to N relation with my table, which I defined this way :

->setRelationNtoN('doc_manquants', 'etude_plans_documents_manquants', 'etude_plans_liste_documents', 'no_enregistrement', 'id_document', 'label')

As I understand, the first parameter ($fieldName), is not an existing column in the table. It's used to name the "virtual" column (for column names, edition label, etc.). That previous line of code worked perfectly in grocery-crud enterprise 2.3.3. Yesterday I upgraded, and I now get this error message :

( ! ) Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'etude_plans.doc_manquants' in 'field list'' in /Users/cletourneau/projects/ipsum/application/libraries/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php on line 360
( ! ) PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'etude_plans.doc_manquants' in 'field list' in /Users/cletourneau/projects/ipsum/application/libraries/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php on line 360

The error message disappears if I comment out the setRelationNtoN.

 

Am I doing something wrong, or can you confirm the problem?

 

Thanks


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

Posted 06 October 2017 - 18:42 PM

Hello @cletourneau,

 

Apparently I can't reproduce your issue. The version that we have on the website for example is the 2.3.4 (check https://www.grocerycrud.com/enterprise/api-and-function-list/setRelationNtoN) Can you please give us more information about your problem?

1. More specifically, is it possible post the full function that you are using? For example:
 

$crud->columns()
$crud->....

2. When this error appears? On the grid, on the add/edit form?

 

Regards

Johnny


cletourneau
  • profile picture
  • Member

Posted 06 October 2017 - 19:46 PM

Yes, I found when that happened exactly.

 

I have a callbackColumn for another field (which translates 0 and 1 to text), and as soon as this line is present, I get the error. If I comment out the callbackColumn the setRelationNtoN works flawlessly.

 

Carl


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

Posted 14 October 2017 - 02:29 AM

Hello Carl,

 

Thanks for the detailed bug report. This issue is also fixed now at the latest version of Grocery CRUD Enterprise (version 2.3.6)

Regards

Johnny