/** * 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); }
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); }
/** * 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)); }
/** * 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)); }
/** * Returns all content objects of $contentTypeId. * * @param mixed $contentTypeId * * @return int[] */ protected function getContentIdsByContentTypeId($contentTypeId) { return $this->contentGateway->getContentIdsByContentTypeId($contentTypeId); }