When overriding find in the model with a custom query class, how can I have default conditions in that query class?

Hi.

I have a custom query class for a model:


namespace app\models;


use yii\db\ActiveQuery;


class ProductQuery extends ActiveQuery

{

    /**

     * @inheritdoc

     * @return \app\models\Project[]|array

     */

    public function all($db = null) {

        return parent::all($db);

    }


    /**

     * @inheritdoc

     * @return \app\models\Project|array|null

     */

    public function one($db = null) {

        return parent::one($db);

    }


    public function withoutFirst()

    {

        $this->andWhere(['<>', 'id', 1]);


        return $this;

    }

}

and I override find() method in my model:


namespace app\models;

use yii\db\ActiveRecord;

class Product extends ActiveRecord

{

    /**

     * @inheritdoc

     * @return ProductQuery

     */

    public static function find()

    {

        return new ProductQuery(get_called_class());

    }

}

Then I can use it, for example, like this:


$products = Products::find()->withoutFirst()->all();

But my question is … how can I set in the query class default conditions ?

When my find method() was the original it was like this:


    public static function find()

    {

        return parent::find()->where(['=', 'status_id', 1]);

    }



but now the ProductQuery takes the control, I don’t know how to put them in the one() and all() methods

Thank yu