/** * 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); }
/** * Returns all field IDs of $contentId grouped by their type. * If $versionNo is set only field IDs for that version are returned. * * @param int $contentId * @param int|null $versionNo * * @return int[][] */ public function getFieldIdsByType($contentId, $versionNo = null) { try { return $this->innerGateway->getFieldIdsByType($contentId, $versionNo); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }