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);
     }
 }
 /**
  * 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);
     }
 }
Beispiel #3
0
 /**
  * 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'));
         }
     }
 }
Beispiel #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']);
     }
 }
 /**
  * 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);
 }