civicrm / org.civicrm.api4

CiviCRM api version 4
Other
8 stars 19 forks source link

Keep getting errors "DB Error: no such field" #208

Open tobiberlin opened 4 years ago

tobiberlin commented 4 years ago

Hi,

the devloper help of API 4 gave me the following code snippet for PHP:

$result = \Civi\Api4\CustomValue::get('Kandidaturen_und_Mandate') ->setSelect([ 'Drupal_8_Id', 'Parlamentsprojekt', 'Fraktion', 'Wahlkreis' ]) ->addWhere('Drupal_8_Id', '=', 89567) ->setLimit(25) ->setCheckPermissions(true) ->execute();

I try to load a custom field set with multiple values by the value of the field "Drupal_8_Id". The problem is the "addWhere" part. The query which is started in DB_mysqli->simpleQuery() looks like

SELECT a.id asid, a.drupal_8_id_101 asDrupal_8_Id, a.parlamentsprojekt_100 asParlamentsprojekt, a.fraktion_102 asFraktion, a.wahlkreis_103 asWahlkreis FROM civicrm_value_kandidaturen__11 a WHERE (a.Drupal_8_Id= "89567") LIMIT 25 OFFSET 0

It seems that the name of the field is not correctly translated to the name of the real coulmn in the table?!