How to do the contain in contain in model->get()

For example: we purchases, purchasedetails and items table,
now we are in action view of purchasesController and how to make this code work to get all items propertys
$purchase = $this->Purchases->get($id, [‘contain’ => [‘Purchasedetails’ => [‘contain’ => ‘Items’] ]]); ?

Thanks,

u can try like:

$purchase = $this->Purchases->get($id, [
    'contain' => ['Purchasedetails.Items']
); 
2 Likes