-
Notifications
You must be signed in to change notification settings - Fork 68
Add method bulkGet #91
base: master
Are you sure you want to change the base?
Conversation
* | ||
* @throws HTTPException | ||
* | ||
* @return array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The body of the response is an array? What type are the elements in the array exactly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your link is broken
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so it should also be
* @return array | |
* @return array<int, array<string, string>> |
correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. Please add tests for your new added method.
Co-Authored-By: Grégoire Paris <[email protected]>
* | ||
* @return array | ||
*/ | ||
public function bulkGet(array $docs = []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a return type declaration here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this return type is too complex for method documentation. We can add a link to method's official documentation http://docs.couchdb.org/en/2.2.0/api/database/bulk-api.html#db-bulk-get
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it return other PHP types than array
like the previous return annotation suggests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was suggesting this
public function bulkGet(array $docs = []) | |
public function bulkGet(array $docs = []): array |
Co-Authored-By: Grégoire Paris <[email protected]>
$docs = []; | ||
$expectedRows = []; | ||
foreach (range(1, 3) as $i) { | ||
list($id, $rev) = $client->postDocument(['foo' => 'bar'.$i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
list($id, $rev) = $client->postDocument(['foo' => 'bar'.$i]); | |
[$id, $rev] = $client->postDocument(['foo' => 'bar'.$i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The composer constraint is currently "php": ">=5.4"
, but I assume we are going to have at least 7.2 soon.
Co-Authored-By: Grégoire Paris <[email protected]>
Done |
Please associate your email address with your Github account, or change the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You requested my review so here it is: please address the changes we asked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to what @greg0ire wrote, we need to bump the minimum supported PHP version in composer.json. I suggest 7.2.
This method can be called to query several documents in bulk. It is well suited for fetching a specific revision of documents, as replicators do for example, or for getting revision history.