/** * Loads a tag object from its $remoteId. * * Optionally a translation filter may be specified. If specified only the * translations with the listed language codes will be retrieved. If not, * all translations will be retrieved. * * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If the specified tag is not found * * @param string $remoteId * @param string[] $translations * @param bool $useAlwaysAvailable * * @return \Netgen\TagsBundle\SPI\Persistence\Tags\Tag */ public function loadByRemoteId($remoteId, array $translations = null, $useAlwaysAvailable = true) { $rows = $this->gateway->getFullTagDataByRemoteId($remoteId, $translations, $useAlwaysAvailable); if (empty($rows)) { throw new NotFoundException('tag', $remoteId); } $tag = $this->mapper->extractTagListFromRows($rows); return reset($tag); }
/** * Returns an array with basic tag data for the tag with $remoteId. * * @throws \RuntimeException * * @param string $remoteId * @param string[] $translations * @param bool $useAlwaysAvailable * * @return array */ public function getFullTagDataByRemoteId($remoteId, array $translations = null, $useAlwaysAvailable = true) { try { return $this->innerGateway->getFullTagDataByRemoteId($remoteId, $translations, $useAlwaysAvailable); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }