-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DocumentHandler -> update pass $document twice to updateById #253
Comments
I think it works as it is now, but you are right that it is misleading as it is and should be fixed. DocumentHandler.php (at the very bottom) has an The first call parameter of The second parameter of
I will leave this ticket open so it will be fixed. |
Thank you. Seems to me all the CRUD functions should require a $collection argument to be consistent. It will be great to get fixed. |
I think right now an update attempt will fail for cases in which $documentHandler = new DocumentHandler("test");
$document = Document::createFromArray([ "_key" => "testKey" ]);
$documentHandler->update($document); This will fail with the exact same error message that you posted. This is because there is an attempt to pull out the collection name from the document, but there is none present. $documentHandler = new DocumentHandler("test");
$document = Document::createFromArray([ "_key" => "testKey", "_id" => "test/testKey" ]);
$documentHandler->update($document); Yet another way is to call $documentHandler = new DocumentHandler("test");
$document = Document::createFromArray([ "_key" => "testKey" ]);
$documentHandler->updateById("test", "testKey", $document); Similar functions exist for replacing ( The problem with changing the signature of |
public function update(Document $document, array $options = [])
{
$documentId = $this->getDocumentId($document);
return $this->updateById($document, $documentId, $document, $options);
}
It seems the first arg to call to updateById should be $collection, and the update function does not accept $collection. Am I missing something?
The text was updated successfully, but these errors were encountered: