Override defaultScope

My defaultScope looks like this:




    public function defaultScope()

    {

        return array(

            'condition' => '`is_active` = 1, `is_verified` = 1, `is_banned` = 0',

            'order' => 'position ASC',

        );

    }



This defaultScope thing is really great for the frontend of my web project, but backstage I’d like to see ALL entries. Is there a possibility to override the defaultScope? Something like:




Product::model()->findAll(array('defaultScope' => false));



I know there are named scopes, so please don’t explain my how to use them ;) As there are many relations between tables and every table has it’s own defaultScopes I don’t want remember all those scope names :)

Since 1.1.2 you can do the following:




Product::model()->resetScope()->findAll();



Grrreat! Thanks again, samdark! … but it doesn’t work :frowning:

Controller:




$this->_model = ListType::model()->resetScope()->findbyPk($typeId);



SQL-Log:


SELECT * FROM `ListType` `ListType` WHERE (`ListType`.`is_active` = 1) AND (`ListType`.`id`='32') LIMIT 1

Model:




public function defaultScope()

    {

        return array(

            'alias' => $this->tableName(),

            'condition' => sprintf('`%s`.`is_active` = 1', $this->tableName())

        );

    }