src/aws/TaggableActiveWindow.php
public function callbackSaveRelation($tagId)
    {
        $find = TagRelation::find()->where(['tag_id' => $tagId, 'table_name' => TaggableTrait::cleanBaseTableName($this->tableName), 'pk_id' => $this->getItemId()])->one();

        if ($find) {
            TagRelation::deleteAll(['tag_id' => $tagId, 'table_name' => TaggableTrait::cleanBaseTableName($this->tableName), 'pk_id' => $this->getItemId()]);
            return 0;
        } else {
            $model = new TagRelation();
            $model->setAttributes([
                'tag_id' => $tagId,
                'table_name' => TaggableTrait::cleanBaseTableName($this->tableName),
                'pk_id' => $this->getItemId(),
            ]);
            $model->insert(false);
            return 1;
        }
    }
public function callbackSaveRelation($tagId)
    {
        $find = TagRelation::find()->where(['tag_id' => $tagId, 'table_name' => TaggableTrait::cleanBaseTableName($this->tableName), 'pk_id' => $this->getItemId()])->one();

        if ($find) {
            TagRelation::deleteAll(['tag_id' => $tagId, 'table_name' => TaggableTrait::cleanBaseTableName($this->tableName), 'pk_id' => $this->getItemId()]);
            return 0;
        } else {
            $model = new TagRelation();
            $model->setAttributes([
                'tag_id' => $tagId,
                'table_name' => TaggableTrait::cleanBaseTableName($this->tableName),
                'pk_id' => $this->getItemId(),
            ]);
            $model->insert(false);
            return 1;
        }
    }
public function callbackSaveRelation ( $ tagId ) { $ find = TagRelation :: find ( ) -> where ( [ 'tag_id' => $ tagId , 'table_name' => TaggableTrait :: cleanBaseTableName ( $ this -> tableName ) , 'pk_id' => $ this -> getItemId ( ) ] ) -> one ( ) ; if ( $ find ) { TagRelation :: deleteAll ( [ 'tag_id' => $ tagId , 'table_name' => TaggableTrait :: cleanBaseTableName ( $ this -> tableName ) , 'pk_id' => $ this -> getItemId ( ) ] ) ; return 0 ; } else { $ model = new TagRelation ( ) ; $ model -> setAttributes ( [ 'tag_id' => $ tagId , 'table_name' => TaggableTrait :: cleanBaseTableName ( $ this -> tableName ) , 'pk_id' => $ this -> getItemId ( ) , ] ) ; $ model -> insert ( false ) ; return 1 ; } }
Save or delete a given tag id from the list of tags.

@param integer $tagId The id of the tag.
@return number
Save or delete a given tag id from the list of tags .