public static function deleteAll($condition = null)
    {
        $pks = self::fetchPks($condition);
        if (empty($pks)) {
            return 0;
        }

        $db = static::getDb();
        $attributeKeys = [];
        $db->executeCommand('MULTI');
        foreach ($pks as $pk) {
            $pk = static::buildKey($pk);
            $db->executeCommand('LREM', [static::keyPrefix(), 0, $pk]);
            $attributeKeys[] = static::keyPrefix() . ':a:' . $pk;
        }
        $db->executeCommand('DEL', $attributeKeys);
        $result = $db->executeCommand('EXEC');

        return end($result);
    }
public static function deleteAll($condition = null)
    {
        $pks = self::fetchPks($condition);
        if (empty($pks)) {
            return 0;
        }

        $db = static::getDb();
        $attributeKeys = [];
        $db->executeCommand('MULTI');
        foreach ($pks as $pk) {
            $pk = static::buildKey($pk);
            $db->executeCommand('LREM', [static::keyPrefix(), 0, $pk]);
            $attributeKeys[] = static::keyPrefix() . ':a:' . $pk;
        }
        $db->executeCommand('DEL', $attributeKeys);
        $result = $db->executeCommand('EXEC');

        return end($result);
    }
public static function deleteAll ( $ condition = null ) { $ pks = self :: fetchPks ( $ condition ) ; if ( empty ( $ pks ) ) { return 0 ; } $ db = static :: getDb ( ) ; $ attributeKeys = [ ] ; $ db -> executeCommand ( 'MULTI' ) ; foreach ( $ pks as $ pk ) { $ pk = static :: buildKey ( $ pk ) ; $ db -> executeCommand ( 'LREM' , [ static :: keyPrefix ( ) , 0 , $ pk ] ) ; $ attributeKeys [ ] = static :: keyPrefix ( ) . ':a:' . $ pk ; } $ db -> executeCommand ( 'DEL' , $ attributeKeys ) ; $ result = $ db -> executeCommand ( 'EXEC' ) ; return end ( $ result ) ; }
Deletes rows in the table using the provided conditions.
WARNING: If you do not specify any condition, this method will delete ALL rows in the table.

For example, to delete all customers whose status is 3:

~~~
Customer::deleteAll(['status' => 3]);
~~~

@param array $condition the conditions that will be put in the WHERE part of the DELETE SQL.
Please refer to [[ActiveQuery::where()]] on how to specify this parameter.
@return int the number of rows deleted
Deletes rows in the table using the provided conditions . WARNING : If you do not specify any condition this method will delete ALL rows in the table .