AnsweredAssumed Answered

How to apply a custom property to a node

Question asked by dallinns on Mar 22, 2011
Latest reply on Mar 28, 2011 by ddanninger
I have the following code and I'm trying to create a new document of a custom type with a custom property. It successfully creates the node with the custom type({http://www.someco.com/model/content/1.0}mine) , but it's not assigning the custom property ({http://www.someco.com/model/content/1.0}section).

Any hints on how to accomplish this? What am I doing wrong?

$newNode = $companyHome->createChild('{http://www.someco.com/model/content/1.0}mine', 'cm_contains', $contentName);

$contentData = new ContentData($newNode, 'cm:content');

$contentData->mimetype = 'text/html';
$contentData->content= "<html><head><title>This is my content</title></head><body>Content</body></html>";
$newNode->cm_name = $contentName;
$newNode->cm_description = 'Page Description';
$newNode->sc_section = "ENGL316001";
$properties = $newNode->getProperties();
$properties['{http://www.someco.com/model/content/1.0}section'] = "ENGL316001";
$contentData->encoding = 'UTF-8';
$newNode->cm_content = $contentData;
$session->save();

Outcomes