Cakephp 3 query OR Condition -
guys how can apply or condition in following statement ?
$this->ibcommisions->find()->matching( 'users.accounts',function ($q) { return $q->where(['ibcommisions.ib_id' => $this->userid, 'users.country_id' => $this->request->data['country']]); }
to become
(['ibcommisions.ib_id' => $this->userid or 'users.country_id' => $this->request->data['country']])
return $q->where(['or' => [ 'ibcommisions.ib_id' => $this->userid, 'users.country_id' => $this->request->data['country'] ]]);
or alternatively
return $q->where(['ibcommisions.ib_id' => $this->userid]) ->orwhere(['users.country_id' => $this->request->data['country']]);
http://book.cakephp.org/3.0/en/orm/query-builder.html#advanced-conditions
Comments
Post a Comment