src/Model/Entity/TagAwareTrait.php
protected function _updateTags($tags, $saveStrategy)
    {
        $table = TableRegistry::getTableLocator()->get($this->source());
        $behavior = $table->behaviors()->Tag;
        $assoc = $table->getAssociation($behavior->getConfig('tagsAlias'));
        $resetStrategy = $assoc->getSaveStrategy();
        $assoc->setSaveStrategy($saveStrategy);
        $table->patchEntity($this, [$assoc->getProperty() => $tags]);
        $result = $table->save($this);
        $assoc->setSaveStrategy($resetStrategy);

        return $result;
    }
protected function _updateTags($tags, $saveStrategy)
    {
        $table = TableRegistry::getTableLocator()->get($this->source());
        $behavior = $table->behaviors()->Tag;
        $assoc = $table->getAssociation($behavior->getConfig('tagsAlias'));
        $resetStrategy = $assoc->getSaveStrategy();
        $assoc->setSaveStrategy($saveStrategy);
        $table->patchEntity($this, [$assoc->getProperty() => $tags]);
        $result = $table->save($this);
        $assoc->setSaveStrategy($resetStrategy);

        return $result;
    }
protected function _updateTags ( $ tags , $ saveStrategy ) { $ table = TableRegistry :: getTableLocator ( ) -> get ( $ this -> source ( ) ) ; $ behavior = $ table -> behaviors ( ) -> Tag ; $ assoc = $ table -> getAssociation ( $ behavior -> getConfig ( 'tagsAlias' ) ) ; $ resetStrategy = $ assoc -> getSaveStrategy ( ) ; $ assoc -> setSaveStrategy ( $ saveStrategy ) ; $ table -> patchEntity ( $ this , [ $ assoc -> getProperty ( ) => $ tags ] ) ; $ result = $ table -> save ( $ this ) ; $ assoc -> setSaveStrategy ( $ resetStrategy ) ; return $ result ; }
Tag entity with given tags.

@param string|array $tags List of tags as an array or a delimited string (comma by default).
@param string $saveStrategy Whether to merge or replace tags.
Valid values 'append', 'replace'.
@return bool|\Cake\ORM\Entity False on failure, entity on success.
Tag entity with given tags .