createLocationsFromNodeAssignments() abstract public method

Convert existing node assignments into real locations.
abstract public createLocationsFromNodeAssignments ( mixed $contentId, mixed $versionNo )
$contentId mixed
$versionNo mixed
 /**
  * Create locations from node assignments
  *
  * Convert existing node assignments into real locations.
  *
  * @param mixed $contentId
  * @param mixed $versionNo
  *
  * @return void
  */
 public function createLocationsFromNodeAssignments($contentId, $versionNo)
 {
     try {
         return $this->innerGateway->createLocationsFromNodeAssignments($contentId, $versionNo);
     } catch (DBALException $e) {
         throw new RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new RuntimeException('Database error', 0, $e);
     }
 }
Example #2
0
 /**
  * Performs the publishing operations required to set the version identified by $updateStruct->versionNo and
  * $updateStruct->id as the published one.
  *
  * The publish procedure will:
  * - Create location nodes based on the node assignments
  * - Update the content object using the provided metadata update struct
  * - Update the node assignments
  * - Update location nodes of the content with the new published version
  * - Set content and version status to published
  *
  * @param int $contentId
  * @param int $versionNo
  * @param \eZ\Publish\SPI\Persistence\Content\MetadataUpdateStruct $metaDataUpdateStruct
  *
  * @return \eZ\Publish\SPI\Persistence\Content The published Content
  */
 public function publish($contentId, $versionNo, MetadataUpdateStruct $metaDataUpdateStruct)
 {
     // Archive currently published version
     $versionInfo = $this->loadVersionInfo($contentId, $versionNo);
     if ($versionInfo->contentInfo->currentVersionNo != $versionNo) {
         $this->setStatus($contentId, VersionInfo::STATUS_ARCHIVED, $versionInfo->contentInfo->currentVersionNo);
     }
     // Set always available name for the content
     $metaDataUpdateStruct->name = $versionInfo->names[$versionInfo->contentInfo->mainLanguageCode];
     $this->contentGateway->updateContent($contentId, $metaDataUpdateStruct, $versionInfo);
     $this->locationGateway->createLocationsFromNodeAssignments($contentId, $versionNo);
     $this->locationGateway->updateLocationsContentVersionNo($contentId, $versionNo);
     $this->setStatus($contentId, VersionInfo::STATUS_PUBLISHED, $versionNo);
     return $this->load($contentId, $versionNo);
 }