Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Common/FieldValueMapper/GeoLocationMapper.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Search\Common\FieldValueMapper;
8
9 use eZ\Publish\Core\Search\Common\FieldValueMapper;
10 use eZ\Publish\SPI\Search\FieldType\GeoLocationField;
11 use eZ\Publish\SPI\Search\Field;
12
16 class GeoLocationMapper extends FieldValueMapper
17 {
25 public function canMap(Field $field)
26 {
27 return $field->type instanceof GeoLocationField;
28 }
29
37 public function map(Field $field)
38 {
39 if ($field->value['latitude'] === null || $field->value['longitude'] === null) {
40 return null;
41 }
42
43 return sprintf('%F,%F', $field->value['latitude'], $field->value['longitude']);
44 }
45 }
eZ\Publish\Core\Search\Common\FieldValueMapper\GeoLocationMapper
Common geo location field value mapper implementation.
Definition: Common/FieldValueMapper/GeoLocationMapper.php:17
eZ\Publish\Core\Search\Common\FieldValueMapper\GeoLocationMapper\canMap
canMap(Field $field)
Check if field can be mapped.
Definition: Common/FieldValueMapper/GeoLocationMapper.php:25
eZ\Publish\Core\Search\Common\FieldValueMapper\GeoLocationMapper\map
map(Field $field)
Map field value to a proper search engine representation.
Definition: Common/FieldValueMapper/GeoLocationMapper.php:37
eZ\Publish\Core\Search\Common\FieldValueMapper
Maps raw field values to something search engine can understand.
Definition: FieldValueMapper.php:21
eZ\Publish\SPI\Search\FieldType\GeoLocationField
GeoLocation document field.
Definition: GeoLocationField.php:15
eZ\Publish\SPI\Search\Field
Definition: SPI/Search/Field.php:19
eZ\Publish\Core\Search\Common\FieldValueMapper
Definition: Search/Common/FieldValueMapper/Aggregate.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.