Load name data for set of content id's and corresponding version number.
abstract public loadVersionedNameData ( array[] $rows ) : array | ||
$rows | array[] | array of hashes with 'id' and 'version' to load names for |
return | array |
/** * Load name data for set of content id's and corresponding version number. * * @param array[] $rows array of hashes with 'id' and 'version' to load names for * * @return array */ public function loadVersionedNameData($rows) { try { return $this->innerGateway->loadVersionedNameData($rows); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }
/** * Returns the versions for $contentId. * * @param int $contentId * * @return \eZ\Publish\SPI\Persistence\Content\VersionInfo[] */ public function listVersions($contentId) { $rows = $this->contentGateway->listVersions($contentId); if (empty($rows)) { return array(); } $idVersionPairs = array_map(function ($row) use($contentId) { return array('id' => $contentId, 'version' => $row['ezcontentobject_version_version']); }, $rows); $nameRows = $this->contentGateway->loadVersionedNameData($idVersionPairs); return $this->contentMapper->extractVersionInfoListFromRows($rows, $nameRows); }
/** * Returns all versions with draft status created by the given $userId. * * @param int $userId * * @return \eZ\Publish\SPI\Persistence\Content\VersionInfo[] */ public function loadDraftsForUser($userId) { $rows = $this->contentGateway->listVersionsForUser($userId, VersionInfo::STATUS_DRAFT); if (empty($rows)) { return array(); } $idVersionPairs = array_map(function ($row) { return array('id' => $row['ezcontentobject_version_contentobject_id'], 'version' => $row['ezcontentobject_version_version']); }, $rows); $nameRows = $this->contentGateway->loadVersionedNameData($idVersionPairs); return $this->mapper->extractVersionInfoListFromRows($rows, $nameRows); }