コード例 #1
0
 /**
  * Deletes the fields for $contentId in $versionInfo from the database
  *
  * @param int $contentId
  * @param \eZ\Publish\SPI\Persistence\Content\VersionInfo $versionInfo
  *
  * @return void
  */
 public function deleteFields($contentId, VersionInfo $versionInfo)
 {
     foreach ($this->contentGateway->getFieldIdsByType($contentId, $versionInfo->versionNo) as $fieldType => $ids) {
         $this->storageHandler->deleteFieldData($fieldType, $versionInfo, $ids);
     }
     $this->contentGateway->deleteFields($contentId, $versionInfo->versionNo);
 }
コード例 #2
0
 /**
  * Inserts a new relation database record
  *
  * @param \eZ\Publish\SPI\Persistence\Content\Relation\CreateStruct $createStruct
  *
  * @return int ID the inserted ID
  */
 public function insertRelation(RelationCreateStruct $struct)
 {
     try {
         return $this->innerGateway->insertRelation($struct);
     } catch (DBALException $e) {
         throw new RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new RuntimeException('Database error', 0, $e);
     }
 }
コード例 #3
0
 /**
  * Batch method for copying all relation meta data for copied Content object.
  *
  * {@inheritdoc}
  *
  * @param int $originalContentId
  * @param int $copiedContentId
  * @param int|null $versionNo If specified only copy for a given version number, otherwise all.
  */
 public function copyRelations($originalContentId, $copiedContentId, $versionNo = null)
 {
     try {
         return $this->innerGateway->copyRelations($originalContentId, $copiedContentId, $versionNo);
     } catch (DBALException $e) {
         throw new RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new RuntimeException('Database error', 0, $e);
     }
 }
コード例 #4
0
 /**
  * Returns all Content IDs for a given $contentTypeId.
  *
  * @param int $contentTypeId
  *
  * @return int[]
  */
 public function getContentIdsByContentTypeId($contentTypeId)
 {
     try {
         return $this->innerGateway->getContentIdsByContentTypeId($contentTypeId);
     } catch (DBALException $e) {
         throw new RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new RuntimeException('Database error', 0, $e);
     }
 }
コード例 #5
0
 /**
  * Load name data for set of content id's and corresponding version number.
  *
  * @param array[] $rows array of hashes with 'id' and 'version' to load names for
  *
  * @return array
  */
 public function loadVersionedNameData($rows)
 {
     try {
         return $this->innerGateway->loadVersionedNameData($rows);
     } catch (DBALException $e) {
         throw new RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new RuntimeException('Database error', 0, $e);
     }
 }
コード例 #6
0
ファイル: TreeHandler.php プロジェクト: Pixy/ezpublish-kernel
 /**
  * Returns the versions for $contentId.
  *
  * @param int $contentId
  *
  * @return \eZ\Publish\SPI\Persistence\Content\VersionInfo[]
  */
 public function listVersions($contentId)
 {
     $rows = $this->contentGateway->listVersions($contentId);
     if (empty($rows)) {
         return array();
     }
     $idVersionPairs = array_map(function ($row) use($contentId) {
         return array('id' => $contentId, 'version' => $row['ezcontentobject_version_version']);
     }, $rows);
     $nameRows = $this->contentGateway->loadVersionedNameData($idVersionPairs);
     return $this->contentMapper->extractVersionInfoListFromRows($rows, $nameRows);
 }
コード例 #7
0
ファイル: Handler.php プロジェクト: Pixy/ezpublish-kernel
 /**
  * Loads relations from $contentId. Optionally, loads only those with $type.
  *
  * Only loads relations against published versions.
  *
  * @param mixed $destinationContentId Destination Content ID
  * @param int|null $type {@see \eZ\Publish\API\Repository\Values\Content\Relation::COMMON,
  *                 \eZ\Publish\API\Repository\Values\Content\Relation::EMBED,
  *                 \eZ\Publish\API\Repository\Values\Content\Relation::LINK,
  *                 \eZ\Publish\API\Repository\Values\Content\Relation::FIELD}
  *
  * @return \eZ\Publish\SPI\Persistence\Content\Relation[]
  */
 public function loadReverseRelations($destinationContentId, $type = null)
 {
     return $this->mapper->extractRelationsFromRows($this->contentGateway->loadReverseRelations($destinationContentId, $type));
 }
コード例 #8
0
 /**
  * Returns the versions for $contentId
  *
  * @param int $contentId
  *
  * @return \eZ\Publish\SPI\Persistence\Content\VersionInfo[]
  */
 public function listVersions($contentId)
 {
     return $this->contentMapper->extractVersionInfoListFromRows($this->contentGateway->listVersions($contentId));
 }
コード例 #9
0
 /**
  * Returns all content objects of $contentTypeId.
  *
  * @param mixed $contentTypeId
  *
  * @return int[]
  */
 protected function getContentIdsByContentTypeId($contentTypeId)
 {
     return $this->contentGateway->getContentIdsByContentTypeId($contentTypeId);
 }