/** * Loads data for all Locations for $contentId, optionally only in the * subtree starting at $rootLocationId * * @param int $contentId * @param int $rootLocationId * * @return array */ public function loadLocationDataByContent($contentId, $rootLocationId = null) { try { return $this->innerGateway->loadLocationDataByContent($contentId, $rootLocationId); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }
/** * Updates path identification string for locations of given $contentId if main language * is set in update struct. * * This is specific to the Legacy storage engine, as path identification string is deprecated. * * @param int $contentId * @param \eZ\Publish\SPI\Persistence\Content\MetadataUpdateStruct $content */ protected function updatePathIdentificationString($contentId, MetadataUpdateStruct $content) { if (isset($content->mainLanguageId)) { $contentLocationsRows = $this->locationGateway->loadLocationDataByContent($contentId); foreach ($contentLocationsRows as $row) { $locationName = ''; $urlAliasRows = $this->urlAliasGateway->loadLocationEntries($row['node_id'], false, $content->mainLanguageId); if (!empty($urlAliasRows)) { $locationName = $urlAliasRows[0]['text']; } $this->locationGateway->updatePathIdentificationString($row['node_id'], $row['parent_node_id'], $this->slugConverter->convert($locationName, 'node_' . $row['node_id'], 'urlalias_compat')); } } }
/** * Loads all locations for $contentId, optionally limited to a sub tree * identified by $rootLocationId * * @param int $contentId * @param int $rootLocationId * * @return \eZ\Publish\SPI\Persistence\Content\Location[] */ public function loadLocationsByContent($contentId, $rootLocationId = null) { $rows = $this->locationGateway->loadLocationDataByContent($contentId, $rootLocationId); return $this->locationMapper->createLocationsFromRows($rows); }