Add delete object method in the container of ObjectStore.#651
Add delete object method in the container of ObjectStore.#651jamiehannaford merged 3 commits intorackspace:workingfrom Ducatel:working
Conversation
|
@Ducatel This is a way around this, but it's not well documented: $container = $objectStoreService->getContainer('{containerName}');
$object = $container->object();
$object->setName('{objectName}');
$object->delete();Your way is easier though |
|
@jamiehannaford Your way can be added in the documentation. EDIT: I find another way with $container = $objectStoreService->getContainer('{containerName}');
$partialObject = $container->getPartialObject('objectName'); // Faster than getObject
$partialObject->delete();EDIT 2: Ok, I found what you explain. It's also working ;) $container = $objectStoreService->getContainer('{containerName}');
$object = new \OpenCloud\ObjectStore\Resource\DataObject($container);
$object->setName('{objectName}');
$object->delete(); |
|
Hi, thanks ;) |
There was a problem hiding this comment.
My problem with this is what happens if a 500 or 403 is returned? All the user will get is false. One option would be to return nothing for success, and an exception for failure. So it could just be:
$this->getClient()
->delete($this->getUrl($name))
->send();What do you think?
There was a problem hiding this comment.
Yes it will be more consistent with the rest of API.
If the code change, we need to update unit test of this function.
|
Sorry this took so long to get to. I've left 1 comment that requires a bit of feedback before we continue |
|
No problem. I will make the update |
|
My fix seems good for you ? |
There was a problem hiding this comment.
No need to have $response = since the variable is never used
|
@Ducatel Thanks for pushing these changes. There's just two very minor issues left before we can merge. In terms of PHP 7, I'm pretty sure the build will always break - so not sure there's much point adding it to the matrix. Same with HHVM. If it passes, though, I'm happy to add. |
|
arf, I forgot to delete theses variables, my apologies... I use PHP7 and HHVM so, I will probably check if all tests are passing on theses environments (and make some fix if necessary) |
Add delete object method in the container of ObjectStore.
|
Sounds good 👍 Feel free to submit a PR if PHP 7 or HHVM works |
|
Ok, no problem. EDIT: Ok, so the version is released ;) |
|
@Ducatel yep, just now 😄 |
|
You can still submit a PR for the Travis builds and I'll increment to v1.16.1 |
Hi everybody,
I add deleteObject method in the container class of object storage API.
This method is faster than the previous way to delete an object from the object storage.
According to the documentation, previously you must download the object and after delete it.
The first step isn't always relevant (Can generate some performance issue if the object is big).
Now you can delete it without downloaded it.
Have fun ;)