public function serializeNodeToJson(JsonSerializationVisitor $visitor, NodeManager $node, array $type, NodeContext $context)
 {
     $serialized = [];
     $repository = $context->getRepository();
     $workspaceName = $context->getWorkspaceName();
     $serialized['name'] = $node->getName();
     $serialized['path'] = $node->getPath();
     $serialized['workspace'] = $workspaceName;
     $serialized['children'] = [];
     foreach ($node->getChildren() as $childNode) {
         $serialized['children'][] = ['name' => $childNode->getName(), 'path' => $childNode->getPath(), 'children' => [], 'hasChildren' => $childNode->hasChildren()];
     }
     $serialized['hasChildren'] = $node->hasChildren();
     if ($node->getPath() != $repository->getRootNode()->getPath()) {
         $serialized['parent'] = $node->getParent()->getName();
     }
     if ($context->isReducedTreeEnabled()) {
         $serialized['reducedTree'] = $node->getReducedTree();
     }
     $serialized['properties'] = $node->getPropertiesAsArray();
     foreach ($serialized['properties'] as $name => $property) {
         if ($property['type'] === PropertyType::WEAKREFERENCE) {
             if (is_array($property['value'])) {
                 foreach ($property['value'] as $subkey => $subvalue) {
                     $serialized['properties'][$name]['value'][$subkey] = $repository->getNodeByIdentifier($subkey)->getPath();
                 }
             } else {
                 $serialized['properties'][$name]['value'] = $repository->getNodeByIdentifier($property['value'])->getPath();
             }
         }
     }
     return $serialized;
 }
 public function getNodeAction(SessionManager $repository, $workspace, $path, Request $request)
 {
     if (!$repository->nodeExists($path)) {
         throw new ResourceNotFoundException('Unknown node');
     }
     $context = new NodeContext($repository, $workspace);
     if ($request->query->has('reducedTree')) {
         $context->enableReducedTree();
     }
     return $this->buildResponseWithContext($repository->getNode($path), $context);
 }