/** * Deletes given version, its fields, node assignment, relations and names. * * Removes the relations, but not the related objects. * * @param int $contentId * @param int $versionNo * * @return bool */ public function deleteVersion($contentId, $versionNo) { $versionInfo = $this->loadVersionInfo($contentId, $versionNo); $this->locationGateway->deleteNodeAssignment($contentId, $versionNo); $this->fieldHandler->deleteFields($contentId, $versionInfo); $this->contentGateway->deleteRelations($contentId, $versionNo); $this->contentGateway->deleteVersions($contentId, $versionNo); $this->contentGateway->deleteNames($contentId, $versionNo); }
/** * Deletes all versions of $contentId. * If $versionNo is set only that version is deleted. * * @param int $contentId * @param int|null $versionNo * * @return void */ public function deleteVersions($contentId, $versionNo = null) { try { return $this->innerGateway->deleteVersions($contentId, $versionNo); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }
/** * Deletes raw content data * * @param int $contentId */ public function removeRawContent($contentId) { $this->locationGateway->removeElementFromTrash($this->loadContentInfo($contentId)->mainLocationId); foreach ($this->listVersions($contentId) as $versionInfo) { $this->fieldHandler->deleteFields($contentId, $versionInfo); } $this->contentGateway->deleteRelations($contentId); $this->contentGateway->deleteVersions($contentId); $this->contentGateway->deleteNames($contentId); $this->contentGateway->deleteContent($contentId); }