delete via AR

I want to do some deleting…

$critiria = new CDbCriteria;

$critiria->order = 'id ASC';

$critiria->limit = '1';

$critiria->condition = 'type=:type';

$critiria->params = array(

':type'=> 3



//not works ->


why the last not work? the findAll added just to check it works, and it indeed works…

dont know how to use the AR delete for this one…

I can create method and go with dao…

I think the problem is that delete dont accept critiria, it accept some sort of array, so maybe someone will exmplain how to convert my critiria to array that delete all will understand

is there a way to delete by complicated critiria via AR ?

There is a CDbCriteria.toArray() function which should do the job.

Your deleteAll looks ok to me and I would expect it to work.

What is the result of your "not works"-deleteAll call?

Do you see an error message/stack?

If you don’t get any error you can try to find the problem by enabling tracing with category system.db.* or*.

I get an error, it dont accept critiria… , it want some mixed array…

maybe CDbCriteria.toArray() will do the job, defiantly will check this one oout

toArray not working…