/**
  * Returns an slice of the results.
  *
  * @param int $offset The offset.
  * @param int $length The length.
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Content[]
  */
 public function getSlice($offset, $length)
 {
     $relatedContent = $this->tagsService->getRelatedContent($this->tag, $offset, $length);
     if (!isset($this->nbResults)) {
         $this->nbResults = $this->tagsService->getRelatedContentCount($this->tag);
     }
     return $relatedContent;
 }
Пример #2
0
 /**
  * @covers \Netgen\TagsBundle\Core\Repository\TagsService::mergeTags
  * @depends testLoadTag
  * @depends testGetRelatedContentCount
  * @depends testGetTagChildrenCount
  */
 public function testMergeTags()
 {
     $tag = $this->tagsService->loadTag(16);
     $targetTag = $this->tagsService->loadTag(40);
     $this->tagsService->mergeTags($tag, $targetTag);
     try {
         $this->tagsService->loadTag($tag->id);
         $this->fail('Tag not deleted after merging');
     } catch (NotFoundException $e) {
         // Do nothing
     }
     $relatedObjectsCount = $this->tagsService->getRelatedContentCount($targetTag);
     $this->assertEquals(3, $relatedObjectsCount);
     $childrenCount = $this->tagsService->getTagChildrenCount($targetTag);
     $this->assertEquals(6, $childrenCount);
 }
Пример #3
0
 /**
  * Returns the number of content objects related to $tag.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user is not allowed to read tags
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If the specified tag is not found
  *
  * @param \Netgen\TagsBundle\API\Repository\Values\Tags\Tag $tag
  *
  * @return int
  */
 public function getRelatedContentCount(Tag $tag)
 {
     return $this->service->getRelatedContentCount($tag);
 }