Here I am getting the all PurchaseRequisitionProducts then I am checking the condition in contain that 'PurchaseOrder.po_type'=>1 then I am getting empty PurchaseOrder array inside PurchaseRequisitionProducts for PurchaseOrder.po_type !=1. Till here the condition is right but i also have to remove those PurchaseRequisitionProducts whose PurchaseOrder is empty or null. So inside contain how can i add the condition like 'PurchaseRequisitionProducts.PurchaseOrder IS NOT NULL'
$this->paginate = [
'contain' => ['PurchaseOrderProducts.PurchaseOrder'=>function($p){
return $p->where(['PurchaseOrder.po_type'=>1]);
},
];
$pr_product = $this->paginate($this->PurchaseRequisitionProducts);