With CakePHP, you can remove multiple records from a database table using the deleteAll() model method.
deleteAll() Usage
Lets say that you wanted to remove all the records for a specific user from the Item model. Below is a quick example.
deleteAll() Example
…where 13 would be the ID of the specific user.
Off course…you can completely truncate a table with the same method, this time removing all conditions. Below is an example of how to truncate a database table using CakePHP.






September 7th, 2008 at 10:14 am
The “deleteAll” requires a condition as first parameter. So your example to truncate a table should be something like this:
$this->Model->deleteAll(’1 = 1′, false);
Personally I think it would make sense if the cake team would implement an additional “truncate” method.