12-15-2008 08:04 PM
// $contentNode is my newly created content.
$contentNode->addAspect("{http://www.alfresco.org/model/content/1.0}generalclassifiable");
$results = $session->query($store, 'PATH:"/cm:generalclassifiable/cm:MyCategory"');
$category = $results[0];
$categoryNodeRef = "workspace://SpacesStore/".$category->getId();
$properties = $contentNode->getProperties();
$properties["{http://www.alfresco.org/model/content/1.0}categories"] = $categoryNodeRef;
$contentNode->setProperties($properties);
// save the session, etc.
But after trying numerous methods I cannot figure out how to do the same with two categories instead of just one. Using arrays will earn me "Array to string conversion" errors even though other content nodes with multiple categories (created via the admin view) actually display them in this manner. Here is a print_r example of a property array from an object created in the Alfresco Web Client with multiple categories set up: …
[{http://www.alfresco.org/model/content/1.0}creator] => dwilson
[{http://www.alfresco.org/model/content/1.0}created] => 2008-07-26T17:12:22.652-07:00
[{http://www.alfresco.org/model/content/1.0}categories] => Array
(
[0] => workspace://SpacesStore/c74a7372-5b71-11dd-941b-79398bf43fa6
[1] => workspace://SpacesStore/bc9d99c9-5b71-11dd-941b-79398bf43fa6
)
…
Here Jean supports the idea that you can indeed treat the cm:categories property as an array in the Javascript API along with all other multi-valued properties.var categories = new Array();
categories["cm:categories"] = catNodes;
upload.addAspect("cm:generalclassifiable", categories);
(Of course the Javascript API has the CategoryNode object in place to support that code.)12-29-2008 12:34 PM
02-13-2009 01:18 PM
11-16-2010 04:11 AM
11-16-2010 03:19 PM
11-17-2010 05:03 AM
11-17-2010 05:42 AM
04-06-2011 12:01 PM
$categoryNodeRefOne= "workspace://SpacesStore/".$categoryOne->getId();
$categoryNodeRefTwo= "workspace://SpacesStore/".$categoryTwo->getId();
$properties["{http://www.alfresco.org/model/content/1.0}categories"] = array(categoryNodeRefOne,categoryNodeRefTwo);
04-07-2011 07:48 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.