Activerecord::deleteall()

Hi,

How can I build this query for ActiveRecord::deleteAll() or how can i use many operators?


DELETE from venues_categories WHERE category_id NOT IN(8,9) AND venue_id = 103

I can use :


 VenuesCategories::deleteAll(['not in', 'category_id', $categoriesList]);

But how can I add the other operator, I think i’m missing something.

Thank you for your help.

If you want, try this method


$model = $connection->createCommand('DELETE from venues_categories WHERE category_id NOT IN(8,9) AND venue_id = 103

');


$model->execute();






User::deleteAll('category_id IN :category_id AND venue_id > :venue_id ', 

         [':category_id ' => $categoriesList, ':venue_id ' => 103]);






Thank you, I thought there was another way beside the string form

I was able of producing the right query using


 VenuesCategories::deleteAll(['and', 'venue_id = :venue_id', ['not in', 'category_id', $categoriesList]], [

                    ':venue_id' => 103

                ]);

I think I should start with the "and" operator and not the "not in"

Thanks anyway