Hi,
I've created a document programmatically. Now I'd like to add it to a resource group this resource belongs to.
How can I do that? Would the code below work?
Thanks for your help.
$fields = array(
'pagetitle' => $title,
'template' => $templateId,
'alias' => $pageAlias,
'published' => $published,
'parent' => $parent,
'hidemenu' => 1,
};
/* create and save new resource */
$response = $this->modx->runProcessor('resource/create', $fields);
$object = $response->getObject();
$resourceId = $object['id'];
// Set the newly created document to the proper group
$groupName = 'MyGroup';
$object->joinGroup($groupName);