function assetTreeFixPhantomNodes(aohs\AssetOperationHandlerService $service, p\Child $child, $params = NULL, &$results = NULL)
{
    // skip entire folder
    if (strpos($child->getPathPath(), "_extra/") !== false) {
        return;
    }
    if (strpos($child->getPathPath(), "_cascade/") !== false) {
        return;
    }
    $type = $child->getType();
    if ($type != a\Page::TYPE && $type != a\DataBlock::TYPE) {
        return;
    }
    try {
        $asset = $child->getAsset($service);
        if ($asset->hasPhantomNodes()) {
            $asset->mapData();
        }
    } catch (e\NoSuchFieldException $e) {
        if ($type == a\Page::TYPE) {
            $asset = new a\PagePhantom($service, $child->toStdClass());
        } else {
            $asset = new a\DataDefinitionBlockPhantom($service, $child->toStdClass());
        }
        $dd = $asset->getDataDefinition();
        $healthy_sd = new p\StructuredData($dd->getStructuredData(), $service, $dd->getId());
        $phantom_sd = $asset->getStructuredDataPhantom();
        $healthy_sd = $healthy_sd->removePhantomNodes($phantom_sd);
        $asset->setStructuredData($healthy_sd);
    }
}
use cascade_ws_property as p;
use cascade_ws_utility as u;
use cascade_ws_exception as e;
$mode = "page";
$mode = "block";
try {
    switch ($mode) {
        case "page":
            $page_id = "5b8f10ee8b7f08ee6e9bc35c0ee70da5";
            $phantom_page = new a\PagePhantom($service, $service->createId(a\PagePhantom::TYPE, $page_id));
            $dd = $phantom_page->getDataDefinition();
            $healthy_sd = new p\StructuredData($dd->getStructuredData(), $service, $dd->getId());
            $phantom_sd = $phantom_page->getStructuredDataPhantom();
            $healthy_sd = $healthy_sd->removePhantomNodes($phantom_sd);
            $phantom_page->setStructuredData($healthy_sd);
            $cascade->getAsset(a\Page::TYPE, $page_id)->dump(true);
            break;
        case "block":
            $block_id = "5bfdb6428b7f08ee6e9bc35c740caf9e";
            $phantom_block = new a\DataDefinitionBlockPhantom($service, $service->createId(a\DataDefinitionBlockPhantom::TYPE, $block_id));
            $dd = $phantom_block->getDataDefinition();
            $healthy_sd = new p\StructuredData($dd->getStructuredData(), $service, $dd->getId());
            $phantom_sd = $phantom_block->getStructuredDataPhantom();
            $healthy_sd = $healthy_sd->removePhantomNodes($phantom_sd);
            $phantom_block->setStructuredData($healthy_sd);
            $cascade->getAsset(a\DataBlock::TYPE, $block_id)->dump(true);
            break;
    }
} catch (\Exception $e) {
    echo S_PRE . $e . E_PRE;
}