public function enabled()
    {
        /* @var $model ActiveRecord */
        $model = new $this->modelClass;
        /** @var ToggableBehavior $toggle */
        if (($toggle = $model->getBehavior('toggable')) === null) {
            throw new InvalidConfigException('Toggable behavior is not enabled on model '.$this->modelClass);
        }

        if (($c = $toggle->enabledAttribute) !== null) {
            $this->andWhere($c);
        } elseif (($c = $toggle->disabledAttribute) !== null) {
            $this->andWhere("NOT $c");
        }

        return $this;
    }
public function enabled()
    {
        /* @var $model ActiveRecord */
        $model = new $this->modelClass;
        /** @var ToggableBehavior $toggle */
        if (($toggle = $model->getBehavior('toggable')) === null) {
            throw new InvalidConfigException('Toggable behavior is not enabled on model '.$this->modelClass);
        }

        if (($c = $toggle->enabledAttribute) !== null) {
            $this->andWhere($c);
        } elseif (($c = $toggle->disabledAttribute) !== null) {
            $this->andWhere("NOT $c");
        }

        return $this;
    }
public function enabled ( ) { /* @var $model ActiveRecord */ $ model = new $ this -> modelClass ; /** @var ToggableBehavior $toggle */ if ( ( $ toggle = $ model -> getBehavior ( 'toggable' ) ) === null ) { throw new InvalidConfigException ( 'Toggable behavior is not enabled on model ' . $ this -> modelClass ) ; } if ( ( $ c = $ toggle -> enabledAttribute ) !== null ) { $ this -> andWhere ( $ c ) ; } elseif ( ( $ c = $ toggle -> disabledAttribute ) !== null ) { $ this -> andWhere ( "NOT $c" ) ; } return $ this ; }
This method is a named scope that adds criteria to select only enabled records.
@return $this
@throws InvalidConfigException
This method is a named scope that adds criteria to select only enabled records .