Class

eZ\Publish\API\Repository\Values\Content\Query\Criterion\MapLocationDistance

class MapLocationDistance extends Criterion implements CriterionInterface, CustomFieldInterface

The MapLocationDistance Criterion class.

Provides content filtering based on distance from geographical location.

Properties

string $operator The operator used by the Criterion.
array(int|string) $value The value(s) matched by the criteria.
string $target The target used by the criteria (field, metadata...).
Value $valueData Additional value data, required by some criterions, MapLocationDistance for instance.

Methods

__construct(string $target, string $operator, float|float[] $distance, float $latitude, float $longitude)

static  createFromQueryBuilder($target, $operator, $value)

from Criterion
Specifications[] getSpecifications()

Criterion description function.

setCustomField(string $type, string $field, string $customField)

Set a custom field to query.

mixed getCustomField(string $type, string $field)

Return custom field.

Details

at line 46
public __construct(string $target, string $operator, float|float[] $distance, float $latitude, float $longitude)

Parameters

string $target FieldDefinition identifier
string $operator One of the supported Operator constants
float|float[] $distance The match value in kilometers, either as an array or as a single value, depending on the operator
float $latitude Latitude of the location that distance is calculated from
float $longitude Longitude of the location that distance is calculated from

in Criterion at line 149
static public createFromQueryBuilder($target, $operator, $value)

Parameters

$target
$operator
$value

at line 52
public Specifications[] getSpecifications()

Criterion description function.

Returns the combination of the Criterion's supported operator/value, as an array of eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications objects - Operator is one supported Operator, as an Operator::* constant - ValueType is the type of input value this operator requires, either array or single - SupportedTypes is an array of types the operator will accept - ValueCountLimitation is an integer saying how many values are expected.

// IN and EQ are supported return array( // The EQ operator expects a single value, either as an integer or a string new Specifications( Operator::EQ, Specifications::INPUTTYPESINGLE, array( Specifications::INPUTVALUEINTEGER, Specifications::INPUTVALUESTRING ), ), // The IN operator expects an array of values, of either integers or strings new Specifications( Operator::IN, Specifications::INPUTTYPEARRAY, array( Specifications::INPUTVALUEINTEGER, Specifications::INPUTVALUESTRING ) ) )*

Return Value

Specifications[]

at line 74
public setCustomField(string $type, string $field, string $customField)

Set a custom field to query.

Set a custom field to query for a defined field in a defined type.

Parameters

string $type
string $field
string $customField

at line 89
public mixed getCustomField(string $type, string $field)

Return custom field.

If no custom field is set, return null

Parameters

string $type
string $field

Return Value

mixed If no custom field is set, return null