0

我有一个 objectId,我想用 Apache Chemistry PHP Library 更改他的名字(例如)。

我尝试使用化学库提供的 updateProperties 方法......但我看不到变化。发生什么事?

$test  = new CMISService($repo_url, $repo_username, $repo_password);
$id = 'ddb6eabd-a862-4e6b-9251-32b6e73300d7';  //existing objectId of the document that his name now is PRUEBAS.

$obj = $test->updateProperties($id, array('cmis:name' => 'PRUEBAS_MODIFIED'));

var_dump($cmis_repo->getObject($obj->id)); // I see that cmis:name continue PRUEBAS instead of PRUEBAS_MODIFIED ¿why?

我可以更改文档的名称吗?

但是我可以完美地更改 cmis:description 属性...为什么 cmis:name 我不能?

4

2 回答 2

1

我比较了 cmislib (python) 和 github 上的 Apache Chemistry PHP 客户端 fork 发送的请求,发现后者发送了以下 atom 请求:

  <atom:title>PRUEBAS</atom:title>
  <atom:summary>PRUEBAS</atom:summary>
  <cmisra:object>
    <cmis:properties>
      <cmis:propertyString propertyDefinitionId="cmis:name">
        <cmis:value>PRUEBAS_MODIFIED</cmis:value>
     </cmis:propertyString>
    </cmis:properties>
  </cmisra:object>

<atom:title>python 客户端在标签中发送新名称。我试图删除<atom:title>and<atom:summary>标记并将文本通过发送curl --upload-file到 Alfresco 并且这工作正常。

所以我的猜测是,Alfresco 首先考虑<atom:title>标签的值(当尝试更新cmis:name属性时)然后回退到<cmis:value>标签的值。

恕我直言,它可以被认为是 php 客户端库的错误,应该不难修复。

于 2017-03-03T23:51:29.573 回答
1

erny 走在了正确的轨道上。

public function renameObject($objectId, $name)
{
    $properties = array(
        'cmis:name' => $name
    );
    $options = array(
        'title' => $name,
        'summary' => $name,
    );
    return $this->repository->updateProperties($objectId, $properties, $options);
}

这对我有用,实际上您只需要选项数组中的标题即可更改名称

于 2017-06-02T13:39:45.797 回答