当我尝试print_r($temp); exit();
时,我会以逗号分隔的形式获得低于值的值
805,806
但是,当我在MY中传递此值时,不是条件,那么它仅适用于806
而不适用于805
和806
。
下面是我的代码......
public function newOrderList() {
if($this->processRequest){
$conditio = array('User.id'=>$this->requestData['courierId'],'User.user_type'=>2);
$checkUser = $this->User->find('first',array('conditions'=>$conditio));
if(!empty($checkUser)){
$courierId = $this->requestData['courierId'];
$cond = array('OrderRejectedDetail.courier_id'=>$courierId);
$ordRej = $this->OrderRejectedDetail->find('all',array('conditions'=>$cond));
if(!empty($ordRej)){
foreach ($ordRej as $key => $value) {
$orderId[] = $value['OrderRejectedDetail']['order_id'];
}
$temp = implode(',',$orderId);
}
$data = $this->Order->find('all', array(
'conditions' => array(
"NOT" => array("Order.id" => array($temp))
)
));
print_r($data); exit();
}
}
}
答案 0 :(得分:2)
你不再需要内爆,让你的代码像这样:
if(!empty($ordRej)){
foreach ($ordRej as $key => $value) {
$orderId[] = $value['OrderRejectedDetail']['order_id'];
}
// $temp = implode(',', $orderId);
}
$data = $this->Order->find('all', array(
'conditions' => array(
'NOT' => array('Order.id' => $orderId)
)
));