在这里,我获取所有的PurchaseRequisitionProducts,然后检查包含的条件“ PurchaseOrder.po_type” => 1,然后在PurchaseOrder.po_type的PurchaseRequisitionProducts中获取空PurchaseOrder数组!= 1。直到这里条件是正确的,但我还必须删除那些PurchaseOrder为空或为null的PurchaseRequisitionProducts。因此,在其中包含如何添加“ PurchaseRequisitionProducts.PurchaseOrder不为空”之类的条件
$this->paginate = [
'contain' => ['PurchaseOrderProducts.PurchaseOrder'=>function($p){
return $p->where(['PurchaseOrder.po_type'=>1]);
},
];
$pr_product = $this->paginate($this->PurchaseRequisitionProducts);