$new = $modx->newObject('modResource', $newDoc);
$new->save();
$newId = $new->get('id');
var_dump($modx->makeUrl($newId));
возвращает пустоту.
$arr = [
'type' => 'document',
'contentType' => 'text/html',
'published' => 1,
'template' => 1,
'createdby' => 1,
'publishedby' => 1,
'createdon' => time(),
'publishedon' => time(),
'class_key' => 'modResource',
'context_key' => 'web',
'show_in_tree' => 1,
'content_type' => 1,
'pagetitle' => 'Название ресура',
'parent' => 0,
];
$cat = $modx->newObject('modResource');
$cat->fromArray($arr);
$alias = $cat->cleanAlias($arr['pagetitle']);
$cat->set('alias',$alias);
$cat->save();
$aliasPath = $cat->getAliasPath($alias);
$cat->set('uri',$aliasPath);
$cat->save();