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

Popular posts from this blog

Lists in Python -

android - can not access to progress bar in an other activity -

html - Not able to access next element of an array javascript -