Skip to content

Commit 0b831a3

Browse files
committed
Added update method to ObjectStorage
1 parent 3374e2b commit 0b831a3

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/ObjectStore/v1/Models/StorageObject.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,27 @@ public function copy(array $options)
173173
}
174174

175175
/**
176-
* {@inheritdoc}
176+
* Update object system metadata and custom metadata.
177+
*
178+
* @param array $options {@see \OpenStack\ObjectStore\v1\Api::postObject}
179+
*
180+
*/
181+
public function update(array $options)
182+
{
183+
$options += ['name' => $this->name, 'containerName' => $this->containerName];
184+
if (isset($options['metadata']) && is_array($options['metadata']))
185+
{
186+
$options['metadata'] = array_merge($options['metadata'], $this->getMetadata());
187+
}
188+
189+
$response = $this->execute($this->api->postObject(), $options);
190+
$this->metadata = $this->parseMetadata($response);
191+
}
192+
193+
/**
194+
* Update object only custom metadata.
195+
*
196+
* @param array $metadata
177197
*/
178198
public function mergeMetadata(array $metadata)
179199
{

0 commit comments

Comments
 (0)