backend/controllers/TermRelationshipController.php
/**
     * Delete TermRelationship for non-hierarchical Taxonomy
     * which is triggered when the user remove item in Selectize box.
     *
     * @throws \Exception
     * @throws \yii\web\NotFoundHttpException
     */
Delete TermRelationship for non-hierarchical Taxonomy
which is triggered when the user remove item in Selectize box.

@throws \Exception
@throws \yii\web\NotFoundHttpException
Delete TermRelationship for non - hierarchical Taxonomy which is triggered when the user remove item in Selectize box . @throws \ Exception @throws \ yii \ web \ NotFoundHttpException
public function actionAjaxDeleteNonHierarchical()
    {
        if ($termRelationship = Yii::$app->request->post('TermRelationship')) {
            $model = $this->findModel($termRelationship['post_id'], $termRelationship['term_id']);
            if ($model->delete()) {
                if ($term = $this->findTerm($model->term_id)) {
                    $term->updateAttributes(['count' => --$term->count]);
                }
            }
        }
    }
public function actionAjaxDeleteNonHierarchical ( ) { if ( $ termRelationship = Yii :: $ app -> request -> post ( 'TermRelationship' ) ) { $ model = $ this -> findModel ( $ termRelationship [ 'post_id' ] , $ termRelationship [ 'term_id' ] ) ; if ( $ model -> delete ( ) ) { if ( $ term = $ this -> findTerm ( $ model -> term_id ) ) { $ term -> updateAttributes ( [ 'count' => -- $ term -> count ] ) ; } } } }
Delete TermRelationship for non-hierarchical Taxonomy
 which is triggered when the user remove item in Selectize box.
Delete TermRelationship for non - hierarchical Taxonomy which is triggered when the user remove item in Selectize box .