Google\Cloud\Datastore\Transaction::lookup PHP Method

lookup() public method

Example: $key = $datastore->key('Person', 'Bob'); $entity = $transaction->lookup($key); if (!is_null($entity)) { echo $entity['firstName']; // 'Bob' }
public lookup ( Key $key, array $options = [] ) : Entity | null
$key Key $key The identifier to use to locate a desired entity.
$options array [optional] { Configuration Options @type string $className 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. }
return Entity | null
    public function lookup(Key $key, array $options = [])
    {
        $res = $this->lookupBatch([$key], $options);
        return isset($res['found'][0]) ? $res['found'][0] : null;
    }