Google\Cloud\Datastore\Query\Query::filter PHP Method

filter() public method

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 also: https://cloud.google.com/datastore/reference/rest/v1/projects/runQuery#operator_1 Allowed Operators
public filter ( string $property, string $operator, mixed $value ) : Query
$property string The property to filter.
$operator string 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 `>=`.
$value mixed The value to check.
return Query
    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;
    }