Deletes node assignment for given $contentId and $versionNo.
abstract public deleteNodeAssignment ( integer $contentId, integer $versionNo = null ) | ||
$contentId | integer | |
$versionNo | integer |
/** * 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 node assignment for given $contentId and $versionNo * * @param int $contentId * @param int $versionNo * * @return void */ public function deleteNodeAssignment($contentId, $versionNo = null) { try { return $this->innerGateway->deleteNodeAssignment($contentId, $versionNo); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }
/** * Removes all Locations under and including $locationId. * * Performs a recursive delete on the location identified by $locationId, * including all of its child locations. Content which is not referred to * by any other location is automatically removed. Content which looses its * main Location will get the first of its other Locations assigned as the * new main Location. * * @param mixed $locationId * * @return bool */ public function removeSubtree($locationId) { $locationRow = $this->locationGateway->getBasicNodeData($locationId); $contentId = $locationRow['contentobject_id']; $mainLocationId = $locationRow['main_node_id']; $subLocations = $this->locationGateway->getChildren($locationId); foreach ($subLocations as $subLocation) { $this->removeSubtree($subLocation['node_id']); } if ($locationId == $mainLocationId) { if (1 == $this->locationGateway->countLocationsByContentId($contentId)) { $this->removeRawContent($contentId); } else { $newMainLocationRow = $this->locationGateway->getFallbackMainNodeData($contentId, $locationId); $this->changeMainLocation($contentId, $newMainLocationRow['node_id'], $newMainLocationRow['contentobject_version'], $newMainLocationRow['parent_node_id']); } } $this->locationGateway->removeLocation($locationId); $this->locationGateway->deleteNodeAssignment($contentId); }