⚠ 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

Don't find field in setRelation with where clause



nunenthal

nunenthal
  • profile picture
  • Member

Posted 17 January 2020 - 10:51 AM

Hello,

 

I tried to write this :

 

        $crud->setRelation('dossier_id', 'dossier', 'nom_dossier',"dossier.user_id = '$client_id'");
 
The clause where use the alternative syntax, but I get the same error with traditionnal syntax in bracket
 
<p>Type: PDOException</p>
<p>Message: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'dossier.user_id' in 'where clause'</p>
<p>Filename: /home/quadralguy/public_html/application/libraries/GroceryCrudEnterprise/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php</p>
<p>Line Number: 360</p>
 

The problem is that my column dossier.user_id really exist !!!

 

Please Help

.

 


Soreno

Soreno
  • profile picture
  • Member

Posted 17 January 2020 - 15:41 PM

Hello, nunenthal.

Try this

$crud->setRelation('dossier_id', 'dossier', 'nom_dossier', ['user_id' => $client_id]);