Ich habe 2 Tabellen.cakephp 3 queryBuilder für assoziative Daten
Tabelle 1:
product_prices:
id | price |description |pack |display |created |modified |
Tabelle 2:
payment_infos:
id |payer |pay_date |product_price_id |product_price |
Im payment_infos
Modell
$this->belongsTo('ProductPrices', [
'foreignKey' => 'product_price_id',
'className' => 'ProductPrices',
]);
Ich habe diese Anfrage:
$query = $this->find('all', [
'contain' => ['ProductPrices']
]));
Bei der Ausführung der obigen Abfrage ich die folgende Fehlermeldung erhalten:
Warning (512): Association property name "product_price" clashes
with field of same name of table "payment_infos".
You should explicitly specify the "propertyName" option.
[CORE\src\ORM\Association.php, line 722]
ersetzen ' 'classname' => 'ProductPrices'' mit'' joinType '=>' INNER''. Hast du eine Bake-Konsole benutzt, um ein Modell zu erstellen? Was willst du erreichen? – Sam