Вот моя модель продукта:
$this->table('products');
$this->belongsTo('OrderProducts', [
'foreignKey' => 'order_product_id',
'propertyName' => 'order_product',
'joinType' => 'INNER'
]);
$this->hasMany('RefundProducts', [
'foreignKey' => 'product_id',
'sort' => ['RefundProducts.created' => 'DESC'],
'propertyName' => 'refund_products',
'className' => 'RefundProducts'
]);
Мой запрос:
$result = $this->Products->find('all', [
'contain' => [
'RefundProducts' => [
'PriceUnits',
'conditions' => $refund_condition,
]
]
]);
но он получает весь продукт, я хочу получить только продукт с RefundProducts