コード例 #1
0
 public function getLocationContentMainLanguageId($locationId)
 {
     try {
         return $this->innerGateway->getLocationContentMainLanguageId($locationId);
     } catch (DBALException $e) {
         throw new \RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new \RuntimeException('Database error', 0, $e);
     }
 }
コード例 #2
0
 /**
  * Returns next value for "id" column.
  *
  * @return mixed
  */
 public function getNextId()
 {
     try {
         return $this->innerGateway->getNextId();
     } catch (DBALException $e) {
         throw new \RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new \RuntimeException('Database error', 0, $e);
     }
 }
コード例 #3
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'));
         }
     }
 }
コード例 #4
0
 /**
  * Recursively removes aliases by given $id and $action.
  *
  * $original parameter is used to limit removal of moved Location aliases to history entries only.
  *
  * @param mixed $id
  * @param string $action
  * @param mixed $original
  */
 protected function removeSubtree($id, $action, $original)
 {
     // Remove first to avoid unnecessary recursion.
     if ($original) {
         // If entry is original remove all for action (history and custom entries included).
         $this->gateway->remove($action);
     } else {
         // Else entry is history, so remove only for action with the id.
         // This means $id grouped history entries are removed, other history, active autogenerated
         // and custom are left alone.
         $this->gateway->remove($action, $id);
     }
     // Load all autogenerated for parent $id, including history.
     $entries = $this->gateway->loadAutogeneratedEntries($id, true);
     foreach ($entries as $entry) {
         $this->removeSubtree($entry['id'], $entry['action'], $entry['is_original']);
     }
 }
コード例 #5
0
 /**
  * Sets storage gateway to the migration table.
  *
  * @see \eZ\Bundle\EzPublishMigrationBundle\Command\LegacyStorage\RegenerateUrlAliasesCommand::MIGRATION_TABLE
  */
 protected function setMigrationTable()
 {
     $this->urlAliasGateway->setTable(static::MIGRATION_TABLE);
 }