Queries can be created either by using the builder pattern, or by providing a Query when creating this object. Example: use Google\Cloud\ServiceBuilder; $cloud = new ServiceBuilder(); $datastore = $cloud->datastore(); $query = $datastore->query(); $query->kind('Person'); $query->filter('firstName', 'Bob'); $result = $datastore->runQuery($query); Queries can also be constructed using a Query Object: $query = $datastore->query([ 'query' => [ 'kind' => [ [ 'name' => 'People' ] ], 'filter' => [ 'propertyFilter' => [ 'op' => 'EQUAL', 'property' => [ 'name' => 'firstName' ], 'value' => [ 'stringValue': 'Bob' ] ] ] ] ]); $result = $datastore->runQuery($query);
См. также: https://cloud.google.com/datastore/reference/rest/v1/projects/runQuery#query Query Object Reference
См. также: https://cloud.google.com/datastore/docs/concepts/queries Datastore Queries
Наследование: implements Google\Cloud\Datastore\Query\QueryInterface, use trait Google\Cloud\Datastore\DatastoreTrait
Пример #1
0
 public function testConstructorOptions()
 {
     $query = new Query($this->mapper, ['query' => ['foo' => 'bar']]);
     $this->assertEquals($query->queryObject(), ['foo' => 'bar']);
 }