loadLocationEntries() abstract public method

Loads list of aliases by given $locationId.
abstract public loadLocationEntries ( mixed $locationId, boolean $custom = false, mixed $languageId = false ) : array
$locationId mixed
$custom boolean
$languageId mixed
return array
コード例 #1
0
 /**
  * Loads list of aliases by given $locationId.
  *
  * @param mixed $locationId
  * @param bool $custom
  * @param mixed $languageId
  *
  * @return array
  */
 public function loadLocationEntries($locationId, $custom = false, $languageId = false)
 {
     try {
         return $this->innerGateway->loadLocationEntries($locationId, $custom);
     } catch (DBALException $e) {
         throw new \RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new \RuntimeException('Database error', 0, $e);
     }
 }
コード例 #2
0
 public function locationSwapped($location1Id, $location1ParentId, $location2Id, $location2ParentId)
 {
     $location1Entries = $this->gateway->loadLocationEntries($location1Id);
     $location2Entries = $this->gateway->loadLocationEntries($location2Id);
     $location1MainLanguageId = $this->gateway->getLocationContentMainLanguageId($location1Id);
     $location2MainLanguageId = $this->gateway->getLocationContentMainLanguageId($location2Id);
     // Load autogenerated entries to find alias ID
     $autoLocation1 = $this->gateway->loadAutogeneratedEntry("eznode:{$location1Id}");
     $autoLocation2 = $this->gateway->loadAutogeneratedEntry("eznode:{$location2Id}");
     // Historize everything first to avoid name conflicts in case swapped Locations are siblings
     $this->historizeBeforeSwap($location1Entries, $location2Entries);
     foreach ($location2Entries as $row) {
         $alwaysAvailable = (bool) ($row['lang_mask'] & 1);
         $languageIds = $this->extractLanguageIdsFromMask($row['lang_mask']);
         foreach ($languageIds as $languageId) {
             $isMainLanguage = $languageId == $location2MainLanguageId;
             $this->internalPublishUrlAliasForLocation($location1Id, $location1ParentId, $row['text'], $languageId, $isMainLanguage && $alwaysAvailable, $isMainLanguage, $autoLocation1['id']);
         }
     }
     foreach ($location1Entries as $row) {
         $alwaysAvailable = (bool) ($row['lang_mask'] & 1);
         $languageIds = $this->extractLanguageIdsFromMask($row['lang_mask']);
         foreach ($languageIds as $languageId) {
             $isMainLanguage = $languageId == $location1MainLanguageId;
             $this->internalPublishUrlAliasForLocation($location2Id, $location2ParentId, $row['text'], $languageId, $isMainLanguage && $alwaysAvailable, $isMainLanguage, $autoLocation2['id']);
         }
     }
 }
コード例 #3
0
ファイル: Handler.php プロジェクト: Pixy/ezpublish-kernel
 /**
  * List of user generated or autogenerated url entries, pointing to $locationId.
  *
  * @param mixed $locationId
  * @param bool $custom if true the user generated aliases are listed otherwise the autogenerated
  *
  * @return \eZ\Publish\SPI\Persistence\Content\UrlAlias[]
  */
 public function listURLAliasesForLocation($locationId, $custom = false)
 {
     $data = $this->gateway->loadLocationEntries($locationId, $custom);
     foreach ($data as &$entry) {
         $entry['raw_path_data'] = $this->gateway->loadPathData($entry['id']);
     }
     return $this->mapper->extractUrlAliasListFromData($data);
 }
コード例 #4
0
ファイル: Handler.php プロジェクト: Pixy/ezpublish-kernel
 /**
  * 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'));
         }
     }
 }