OR conditions in find [solved]


#1

How do you build OR conditions in cakephp 3 find method ?
I could not find any example in the cook book.


How to use orwhere condition in $this->paginate in cakephp 3
#2

Here it is:

https://book.cakephp.org/3.0/en/orm/query-builder.html#advanced-conditions


#3

Thank you for your answer


#4

You are welcome. :slight_smile:

If you have found your solution with my answer then make sure you change the Title of your topic to

OR conditions in find [Solved]

It will save time of those who are here to answer to people’s question.


#5

I want to add OR condition in this paginate array.

$conditions = array();
$conditions[‘Years.id’] = 2;
$this->paginate = [
‘contain’ => [‘Courses’, ‘Streams’, ‘Years’, ‘Subjects’],
‘conditions’ => [$condition]
];


#6

What controller or table are you working with ?

I can see an error:
‘conditions’ => [$condition] should be:
'conditions => $conditions