cakephp 3 queryBuilder for associative data

Viewed 221

I have 2 tables.

Table 1:

product_prices:
id | price |description |pack |display |created |modified |

Table 2:

payment_infos:
id |payer |pay_date |product_price_id |product_price |

In the payment_infos model

$this->belongsTo('ProductPrices', [
        'foreignKey' => 'product_price_id',
        'className'  => 'ProductPrices',
]);

I have this query:

$query = $this->find('all', [
        'contain' => ['ProductPrices']
]));

When running the above query I get the following error:

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]
1 Answers
Related