Friday, March 31, 2017

how to use where condition for association in cakephp

I have a query in laravel that is

    $processing = $this->Orders->find()->contain(['OrderItems.Themes','OrderItems.Products','OrderItems.Products.Users','OrderItems.Themes.Users'])->hydrate(false)->where(['status'=> 'InProcessing'])->toArray();
    prx($processing);

this is look like this

enter image description here

enter image description here

enter image description here

i would like to use where query for inside orders--orderitems--products--users--id how to fix it in a query i try this which give error

    $processing = $this->Orders->find()->contain(['OrderItems.Themes','OrderItems.Products','OrderItems.Products.Users','OrderItems.Themes.Users'])->hydrate(false)->where(['status'=> 'InProcessing','Orders.OrderItems.Products.Users.id'=>$userId])->toArray();
    prx($processing);

ERROR IS

enter image description here



via ram pratap singh

Advertisement