cakephp version 3.8.11, php 7.2, MariaDb 10.2.10
Hi, in the class ProduitsInfosTable, method initialize, i make a belongsTo association :
$this->belongsTo('Marque')
->setClassName(FamillesTable::class)
->setForeignKey('cross_marque_id')
->setBindingKey('commentaire')
->setConditions([
'(CASE WHEN Infos.cross_marque_id = 0 then 0 else 1 end)' => 1,
]);
the error is in the conditions field, Infos.cross_marque_id is replaced by an equivalent lowercased :
LEFT JOIN familles Marque ON ((CASE when infos.cross_marque_id = 0 then 0 else 1 end) :c0 AND Marque.commentaire = (Infos.cross_marque_id))
for information the table ProduitsInfos is aliased itself from class Produits :
$this->hasOne('Infos')
->setClassName(ProduitsInfosTable::class)
->setForeignKey('produitid');
My question is why Infos
become infos
only on where conditions, not on the select and how can i keep the name Ucwordized ?
Produits > hasOne > InfosProduits(Infos) > belongsTo > Familles(Marque)
thx in advance for your help
EDIT : in fact i forgot to ad an equal in my condition, found the solution 1h after :s
‘(CASE WHEN Infos.cross_marque_id = 0 then 0 else 1 end)’ => 1,
‘(CASE WHEN Infos.cross_marque_id = 0 then 0 else 1 end) =’=> 1,