Closed jobrienski closed 6 years ago
As long as an object has an objectId you can set a field and save. Does that not work for you?
I wrote a quick test case and it passes.
public function testUpdateWithoutFetch()
{
$obj = ParseObject::create('TestObject');
$obj->set('test', 'test');
$obj->save();
$t2 = ParseObject::create('TestObject', $obj->getObjectId());
$t2->set('test', 'changed');
$t2->save();
$this->assertEquals('changed', $t2->get('test'), 'Update failed.');
}
Hmm...I'll try that approach. Should the test be for $obj->fetch(); $this->assertEquals('changed', $obj->get('test')); ? I don't know enough about the lifecycle of objects in this library to know for sure.
I believe I’ve answered your question already.
If you are still having issue please write a failing test and open a PR.
Tests for fetch already exist
Ok, thanks for your help.
Issue Description
In older versions of parse php sdks you could update an existing object without fetching by providing the objectId as such: $obj->update($objectId);
None of the documentation in https://docs.parseplatform.org/php/guide/#objects or the entire documentation describes how to update an existing object without fetching. It seems silly to fetch an object to update it.
Not a duplicate of https://github.com/parse-community/parse-php-sdk/issues/196
Steps to reproduce
Read the documentation - be confused as to how you can update an object without fetching. Search through the source code. Continue to be baffled.
Environment Details
Not applicable.
Steps to fix
Please document how to do this in: https://docs.parseplatform.org/php/guide If saving existing object without fetching is not possible, it should be. It is in other language apis for parse.