critiria for deleteAll

this works:


Invoice::model()->deleteAll('userID = ? AND isPaid = ?' , array(Yii::app()->user->id, false));

this not (deletes everything):




Invoice::model()->userID(Yii::app()->user->id)->isPaid(false)->deleteAll();

why?

cant use scopes with delete all ?

right, can’t use scopes with delete all.

This link will help, check out the comment by Woil. He also mentions a workaround it.

http://www.yiiframework.com/doc/guide/1.1/en/database.ar#named-scopes