Exemple #1
0
 /**
  * Loads tags by specified keyword and parent ID.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If the specified tag is not found
  *
  * @param string $keyword The keyword to fetch tag for
  * @param mixed $parentTagId The parent ID to fetch tag for
  * @param string[] $translations The languages to load
  * @param bool $useAlwaysAvailable Check for main language if true (default) and if tag is always available
  *
  * @return \Netgen\TagsBundle\API\Repository\Values\Tags\Tag
  */
 public function loadTagByKeywordAndParentId($keyword, $parentTagId, array $translations = null, $useAlwaysAvailable = true)
 {
     $rows = $this->gateway->getFullTagDataByKeywordAndParentId($keyword, $parentTagId, $translations, $useAlwaysAvailable);
     if (empty($rows)) {
         throw new NotFoundException('tag', $keyword);
     }
     $tag = $this->mapper->extractTagListFromRows($rows);
     return reset($tag);
 }
 /**
  * Returns an array with full tag data for the tag with $parentId parent ID and $keyword keyword.
  *
  * @param string $keyword
  * @param string $parentId
  * @param string[] $translations
  * @param bool $useAlwaysAvailable
  *
  * @return array
  */
 public function getFullTagDataByKeywordAndParentId($keyword, $parentId, array $translations = null, $useAlwaysAvailable = true)
 {
     try {
         return $this->innerGateway->getFullTagDataByKeywordAndParentId($keyword, $parentId, $translations, $useAlwaysAvailable);
     } catch (DBALException $e) {
         throw new RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new RuntimeException('Database error', 0, $e);
     }
 }