Google\Cloud\Datastore\DatastoreClient::lookupBatch PHP Method

lookupBatch() public method

To lookup entities inside a transaction, use {@see \Google\Cloud\Datastore\Transaction::lookupBatch()}. Example: $keys = [ $datastore->key('Person', 'Bob'), $datastore->key('Person', 'John') ]; $entities = $datastore->lookupBatch($keys); foreach ($entities['found'] as $entity) { echo $entity['firstName'] . PHP_EOL; }
public lookupBatch ( array $keys, array $options = [] ) : array
$keys array
$options array [optional] { Configuration Options @type string $readConsistency See [ReadConsistency](https://cloud.google.com/datastore/reference/rest/v1/ReadOptions#ReadConsistency). @type string|array $className If a string, the name of the class to return results as. Must be a subclass of {@see \Google\Cloud\Datastore\Entity}. If not set, {@see \Google\Cloud\Datastore\Entity} will be used. If an array is given, it must be an associative array, where the key is a Kind and the value is the name of a subclass of {@see \Google\Cloud\Datastore\Entity}. @type bool $sort If set to true, results in each set will be sorted to match the order given in $keys. **Defaults to** `false`. }
return array Returns an array with keys [`found`, `missing`, and `deferred`]. Members of `found` will be instance of {@see \Google\Cloud\Datastore\Entity}. Members of `missing` and `deferred` will be instance of {@see \Google\Cloud\Datastore\Key}.
    public function lookupBatch(array $keys, array $options = [])
    {
        return $this->operation->lookup($keys, $options);
    }