0

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);
Devendra
  • 219
  • 2
  • 22
  • 1
    Have a look at **https://stackoverflow.com/questions/26799094/how-to-filter-by-conditions-for-associated-models**. – ndm Sep 29 '18 at 17:57
  • @ndm my issue is not there. I have to remove the array or main pagination array if there contain is blank or not available. – Devendra Sep 30 '18 at 12:53

0 Answers0