Пример #1
0
 /**
  * Moves a tag identified by $sourceId into new parent identified by $destinationParentId.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If $sourceId or $destinationParentId are invalid
  *
  * @param mixed $sourceId
  * @param mixed $destinationParentId
  *
  * @return \Netgen\TagsBundle\SPI\Persistence\Tags\Tag The updated root tag of the moved subtree
  */
 public function moveSubtree($sourceId, $destinationParentId)
 {
     $sourceTagData = $this->gateway->getBasicTagData($sourceId);
     $destinationParentTagData = $this->gateway->getBasicTagData($destinationParentId);
     $this->gateway->moveSubtree($sourceTagData, $destinationParentTagData);
     $timestamp = time();
     $this->updateSubtreeModificationTime($sourceTagData['parent_id'], $timestamp);
     $this->updateSubtreeModificationTime($sourceId, $timestamp);
     return $this->load($sourceId);
 }
Пример #2
0
 /**
  * Moves a tag identified by $sourceTagData into new parent identified by $destinationParentTagData.
  *
  * @throws \RuntimeException
  *
  * @param array $sourceTagData
  * @param array $destinationParentTagData
  */
 public function moveSubtree(array $sourceTagData, array $destinationParentTagData)
 {
     try {
         $this->innerGateway->moveSubtree($sourceTagData, $destinationParentTagData);
     } catch (DBALException $e) {
         throw new RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new RuntimeException('Database error', 0, $e);
     }
 }