Jump to content


setRelationNtoN doesn't work anymore with 2.3.4


  • Please log in to reply
3 replies to this topic

#1 cletourneau

cletourneau

    Member

  • Members
  • PipPip
  • 15 posts
  • LocationMontreal

Posted 06 October 2017 - 03: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



#2 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,095 posts
  • LocationLondon

Posted 06 October 2017 - 06: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.groceryc...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


Posted Image

#3 cletourneau

cletourneau

    Member

  • Members
  • PipPip
  • 15 posts
  • LocationMontreal

Posted 06 October 2017 - 07: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



#4 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,095 posts
  • LocationLondon

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


Posted Image




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users