/** * Loads data for a content object * * Returns an array with the relevant data. * * @param mixed $contentId * @param mixed $version * @param string[] $translations * * @return array */ public function load($contentId, $version, array $translations = null) { try { return $this->innerGateway->load($contentId, $version, $translations); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }
/** * Returns the raw data of a content object identified by $id, in a struct. * * A version to load must be specified. If you want to load the current * version of a content object use SearchHandler::findSingle() with the * ContentId criterion. * * 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. * * @param int|string $id * @param int|string $version * @param string[] $translations * * @return \eZ\Publish\SPI\Persistence\Content Content value object */ public function load($id, $version, array $translations = null) { $rows = $this->contentGateway->load($id, $version, $translations); if (empty($rows)) { throw new NotFound('content', "contentId: {$id}, versionNo: {$version}"); } $contentObjects = $this->mapper->extractContentFromRows($rows, $this->contentGateway->loadVersionedNameData(array(array('id' => $id, 'version' => $version)))); $content = $contentObjects[0]; $this->fieldHandler->loadExternalFieldData($content); return $content; }