AnsweredAssumed Answered

Updating multi-value properties with php

Question asked by bweiss on Jul 22, 2010
Latest reply on Sep 16, 2010 by romain.lamarche
Is it possible to update a multi-value property using the php api? 

Here is what I am trying to do:
    I have created a custom aspect with the multi-value property partnumref.
    I can update this properly via the Alfresco explorer client and also via javascript.
    I would like to create a rule to query an external datasource and add values to partnumref when a document is added or updated.
    I could not figure out how to perform an httpget type function in javascript (seems to only be possible in webscripts).
    In php, it is very simple to call an external page via cURL.
    Unfortunately, I have been unable to set or update a mult-value property in php
This works:
  //Apply the aspects to the file ($httpresults is an array of values)
    //Define the properties
    $props=array('custom_partnumref'=>$httpresults[0]);
    //Add the aspect
    $document->addAspect("custom_stdref", $props);

This does not:
  //Apply the aspects to the file ($httpresults is an array of values)
    //Define the properties
    $props=array('custom_partnumref'=>$httpresults);
    //Add the aspect
    $document->addAspect("custom_stdref", $props);

Nor does updating:
    $props = $document->properties;
    $props['{custom.model}partnumref']=$httpresults;
    $document->properties=$props;

I am using community 3.2r
Typical error might be:

error executing script…

Caused by: java.lang.UnsupportedOperationException: openRead:com.caucho.vfs.NullPath
        at com.caucho.vfs.Path.openReadImpl(Path.java:1319)
        at com.caucho.vfs.Path.openRead(Path.java:1039)
        at com.caucho.quercus.env.Env.getSourceLine(Env.java:4311)
        at com.caucho.quercus.parser.QuercusParser.error(QuercusParser.java:488
        at com.caucho.quercus.expr.Expr.createAssign(Expr.java:172)
        at com.caucho.quercus.parser.QuercusParser.parseAssignExpr(QuercusParse



Any ideas on how to get values from an external data source into a multi-value property based on a rule action (php or otherwise welcome)?

Thanks,
BRAD

Outcomes