Returns data for the first level children of the location identified by given $locationId.
abstract public getChildren ( mixed $locationId ) : array | ||
$locationId | mixed | |
return | array |
/** * Returns data for the first level children of the location identified by given $locationId * * @param mixed $locationId * * @return array */ public function getChildren($locationId) { try { return $this->innerGateway->getChildren($locationId); } 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); }