public function reindex($e)
    {
        $i = 1;
        foreach (self::find()->where([
            'nav_container_id' => $this->nav_container_id,
            'parent_nav_id' => $this->parent_nav_id
        ])->orderBy('sort_index ASC')->asArray()->all() as $model) {
            Yii::$app->db->createCommand()->update(
                self::tableName(),
                ['sort_index' => $i],
                'id=:id',
                ['id' => $model['id']]
            )->execute();
            ++$i;
        }

        switch ($e->name) {
            case 'afterInsert':
                Log::add(1, ['tableName' => 'cms_nav', 'action' => 'insert', 'row' => $this->id], 'cms_nav', $this->id, $this->toArray());
                break;
            case 'afterUpdate':
                Log::add(2, ['tableName' => 'cms_nav', 'action' => 'update', 'row' => $this->id], 'cms_nav', $this->id, $this->toArray());
                break;
            case 'afterDelete':
                Log::add(3, ['tableName' => 'cms_nav', 'action' => 'delete', 'row' => $this->id], 'cms_nav', $this->id, $this->toArray());
                break;
        }
    }
public function reindex($e)
    {
        $i = 1;
        foreach (self::find()->where([
            'nav_container_id' => $this->nav_container_id,
            'parent_nav_id' => $this->parent_nav_id
        ])->orderBy('sort_index ASC')->asArray()->all() as $model) {
            Yii::$app->db->createCommand()->update(
                self::tableName(),
                ['sort_index' => $i],
                'id=:id',
                ['id' => $model['id']]
            )->execute();
            ++$i;
        }

        switch ($e->name) {
            case 'afterInsert':
                Log::add(1, ['tableName' => 'cms_nav', 'action' => 'insert', 'row' => $this->id], 'cms_nav', $this->id, $this->toArray());
                break;
            case 'afterUpdate':
                Log::add(2, ['tableName' => 'cms_nav', 'action' => 'update', 'row' => $this->id], 'cms_nav', $this->id, $this->toArray());
                break;
            case 'afterDelete':
                Log::add(3, ['tableName' => 'cms_nav', 'action' => 'delete', 'row' => $this->id], 'cms_nav', $this->id, $this->toArray());
                break;
        }
    }
public function reindex ( $ e ) { $ i = 1 ; foreach ( self :: find ( ) -> where ( [ 'nav_container_id' => $ this -> nav_container_id , 'parent_nav_id' => $ this -> parent_nav_id ] ) -> orderBy ( 'sort_index ASC' ) -> asArray ( ) -> all ( ) as $ model ) { Yii :: $ app -> db -> createCommand ( ) -> update ( self :: tableName ( ) , [ 'sort_index' => $ i ] , 'id=:id' , [ 'id' => $ model [ 'id' ] ] ) -> execute ( ) ; ++ $ i ; } switch ( $ e -> name ) { case 'afterInsert' : Log :: add ( 1 , [ 'tableName' => 'cms_nav' , 'action' => 'insert' , 'row' => $ this -> id ] , 'cms_nav' , $ this -> id , $ this -> toArray ( ) ) ; break ; case 'afterUpdate' : Log :: add ( 2 , [ 'tableName' => 'cms_nav' , 'action' => 'update' , 'row' => $ this -> id ] , 'cms_nav' , $ this -> id , $ this -> toArray ( ) ) ; break ; case 'afterDelete' : Log :: add ( 3 , [ 'tableName' => 'cms_nav' , 'action' => 'delete' , 'row' => $ this -> id ] , 'cms_nav' , $ this -> id , $ this -> toArray ( ) ) ; break ; } }
Rindex the current pages.

@param \yii\base\Event $e
Rindex the current pages .