Basically, I want to do this in CakePHP:
delete from myTable as mytable where datediff(now(), mytable.date) > 5
And I don't know how to do it with the $this->Model->delete()
function?
You need to use deleteAll
:
$this->Model->deleteAll(array(
'datediff(now(), Model.date) > 5'
)) ;