Google\Cloud\Datastore\Query\GqlQuery::queryObject PHP Method

queryObject() public method

This method is used internally to run queries and is not intended for use outside the internal library API
public queryObject ( ) : array
return array
    public function queryObject()
    {
        $bindingType = $this->options['bindingType'];
        $queryObj = [];
        $queryObj['queryString'] = $this->query;
        $queryObj['allowLiterals'] = (bool) $this->options['allowLiterals'];
        $bindings = $this->mapBindings($bindingType, $this->options['bindings']);
        if (!empty($bindings)) {
            $queryObj[$this->options['bindingType']] = $bindings;
        }
        return $queryObj;
    }

Usage Example

Example #1
0
 public function testJsonSerialize()
 {
     $query = new GqlQuery($this->mapper, 'SELECT * FROM foo');
     $this->assertEquals($query->jsonSerialize(), $query->queryObject());
 }