Datastore/src/Query/Query.php
public function filter($property, $operator, $value)
    {
        if (!isset($this->query['filter']) || !isset($this->query['filter']['compositeFilter'])) {
            $this->initializeFilter();
        }

        $this->query['filter']['compositeFilter']['filters'][] = [
            'propertyFilter' => [
                'property' => $this->propertyName($property),
                'value' => $this->entityMapper->valueObject($value),
                'op' => $this->mapOperator($operator)
            ]
        ];

        return $this;
    }
public function filter($property, $operator, $value)
    {
        if (!isset($this->query['filter']) || !isset($this->query['filter']['compositeFilter'])) {
            $this->initializeFilter();
        }

        $this->query['filter']['compositeFilter']['filters'][] = [
            'propertyFilter' => [
                'property' => $this->propertyName($property),
                'value' => $this->entityMapper->valueObject($value),
                'op' => $this->mapOperator($operator)
            ]
        ];

        return $this;
    }
public function filter ( $ property , $ operator , $ value ) { if ( ! isset ( $ this -> query [ 'filter' ] ) || ! isset ( $ this -> query [ 'filter' ] [ 'compositeFilter' ] ) ) { $ this -> initializeFilter ( ) ; } $ this -> query [ 'filter' ] [ 'compositeFilter' ] [ 'filters' ] [ ] = [ 'propertyFilter' => [ 'property' => $ this -> propertyName ( $ property ) , 'value' => $ this -> entityMapper -> valueObject ( $ value ) , 'op' => $ this -> mapOperator ( $ operator ) ] ] ; return $ this ; }
Add a filter to the query.

If the top-level filter is specified as a propertyFilter, it will be replaced.
Any composite filters will be preserved and the new filter will be added.

Example:
```
$query->filter('firstName', '=', 'Bob')
->filter('lastName', '=', 'Testguy');
```

@see https://cloud.google.com/datastore/reference/rest/v1/projects/runQuery#operator_1 Allowed Operators

@param string $property The property to filter.
@param string $operator The operator to use in the filter. A list of
allowed operators may be found
[here](https://cloud.google.com/datastore/reference/rest/v1/projects/runQuery#operator_1).
Short comparison operators are provided for convenience and are
mapped to their datastore-compatible equivalents. Available short
operators are `=`, `<`, `<=`, `>`, and `>=`.
@param mixed $value The value to check.
@return Query
Add a filter to the query .