Is the function PHP getProperty of a document not yet implemented?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2016 12:09 PM
Am I correct that this function in the PHP library/client for REST automation has not been implemented yet?
$docVersion = $this->documents[$index]->getProperty('dc:version') ;
Where documents[] is the resultset of a call : $this->answer = $this->session->newRequest("Document.Query") ->set('params', 'query', $query) ->setSchema($this->propertiesSchema) ->sendRequest();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2016 08:58 AM
Hi Olaf,
Try :
$this->documents[$index]->getProperty('uid:major_version');
$this->documents[$index]->getProperty('uid:minor_version');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2016 12:12 PM
Thanks for the feedback. I did some further testing.
Function:
/**
* Generialised PropertyGet function
*
* @param string propertyName
* @param string propertyDescription
* @param int index
*
* @return string value
* or
* @return boolean false
*/
private function getDocumentProperty($name, $desc, $index) {
global $logdebug;
if ($index > $this->getNumberOfDocumentsInResultset() ) {
if ($logdebug) {
$this->logger->addInfo($desc . " : the index provided (".$index.") is beyond the scope of the document list (".$this->getNumberOfDocumentsInResultset().")");
}
$value = false ;
}
else {
$value = $this->documents[$index]->getProperty($name) ; // deviation from regular property queries
//$value = $this->documents[$index]->getProperty("'".$name."'") ;
//$value = $this->documents[$index]->getProperty("'dc:creator'") ;
if ($logdebug) {
$this->logger->addInfo("Get property ".$name);
$docname = $this->getDocumentTitle($index);
$this->logger->addInfo("Getting property from document titled '" . $docname . "'");
}
if ($logdebug) {
$this->logger->addDebug("Get ".$desc . " index = ".$index);
$this->logger->addDebug("Get ".$desc . " resultsetsize = ".$this->getNumberOfDocumentsInResultset());
$this->logger->addDebug($desc . " = ".$value);
}
}
return ($value) ;
}
It should be called like: $this->getDocumentProperty('dc:creator', "DocumentCreator", 0)
Result is an empty string. This is regardless of the property.
This is a bit weird as a direct call like: $this->documents[$index]->getTitle()
produces a proper result.
This is especially hard to debug as I see no exceptions or errors, just an empty result string. Any pointers much appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2016 02:13 PM
This code works fine for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2016 11:07 AM
I added the following line to my code the make my monolog debugging more verbose
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2016 04:53 AM
Have you tried to perform the query manually or at least debug the raw response of the Nuxeo server ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2016 10:04 AM
I did test on/with the local nuxeo playground. But that was not an exact test of the querry so I did some further testing which provided more questions than answers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2016 06:30 AM
About your original question and a), make sure to query for at least any schema (*) to get the properties (setSchema method with the PHP Client) as I don't see it in your python sample.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2016 11:33 AM
Thanks. It turned out that in the PHP code the headers were not set properly. $schema='"'"; versus $schema=''; made the difference. Obviously the schema was not set at all in the Python code.
