[Solved]deleteAll() with conditions


#1

Hello,

I want to use the deleteAll(method) but how to tell CakePHP to use the equivalent of the OR in SQL.

Example : i want to say $query = $this->articles->deleteAll([‘user_id’ => $this->Auth->user(‘username’), OR ‘user_timeline’ => $this->Auth->user(‘username’)]);

Thanks


#2

Solved by using an array

$conditions = array(
‘OR’ => array(
‘user_id’ => $this->Auth->user(‘username’),
‘user_timeline’ => $this->Auth->user(‘username’)
)
);

$this->articles->deleteAll($conditions);