/** * Transfers all tag attribute links from tag identified by $tagId into the tag identified by $targetTagId. * * @throws \RuntimeException * * @param mixed $tagId * @param mixed $targetTagId */ public function transferTagAttributeLinks($tagId, $targetTagId) { try { $this->innerGateway->transferTagAttributeLinks($tagId, $targetTagId); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }
/** * Merges the tag identified by $tagId into the tag identified by $targetTagId. * * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If $tagId or $targetTagId are invalid * * @param mixed $tagId * @param mixed $targetTagId */ public function merge($tagId, $targetTagId) { $tagInfo = $this->loadTagInfo($tagId); $targetTagInfo = $this->loadTagInfo($targetTagId); foreach ($this->loadSynonyms($tagId) as $synonym) { $this->gateway->transferTagAttributeLinks($synonym->id, $targetTagId); $this->gateway->deleteTag($synonym->id); } $this->gateway->transferTagAttributeLinks($tagId, $targetTagId); $this->gateway->deleteTag($tagId); $timestamp = time(); $this->updateSubtreeModificationTime($tagInfo->parentTagId, $timestamp); $this->updateSubtreeModificationTime($targetTagInfo->id, $timestamp); }