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

FieldRegistry.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Search\Common;
8
9 use eZ\Publish\SPI\FieldType\Indexable;
10
14 class FieldRegistry
15 {
21 protected $types = [];
22
28 public function __construct(array $types = [])
29 {
30 foreach ($types as $name => $type) {
31 $this->registerType($name, $type);
32 }
33 }
34
41 public function registerType($name, Indexable $type)
42 {
43 $this->types[$name] = $type;
44 }
45
53 public function getType($name)
54 {
55 if (!isset($this->types[$name])) {
56 throw new \OutOfBoundsException("No type registered for $name.");
57 }
58
59 return $this->types[$name];
60 }
61 }
eZ\Publish\Core\Search\Common\FieldRegistry
Registry for field type's Indexable interface implementations available to Search Engines.
Definition: FieldRegistry.php:15
eZ\Publish\Core\Search\Common\FieldRegistry\getType
getType($name)
Get Indexable type.
Definition: FieldRegistry.php:53
eZ\Publish\Core\Search\Common\FieldRegistry\__construct
__construct(array $types=[])
Construct from optional Indexable type array.
Definition: FieldRegistry.php:28
eZ\Publish\Core\Search\Common\FieldRegistry\registerType
registerType($name, Indexable $type)
Register another indexable type.
Definition: FieldRegistry.php:41
eZ\Publish\Core\Search\Common\FieldRegistry\$types
$types
Definition: FieldRegistry.php:21
eZ\Publish\SPI\FieldType\Indexable
The field type interface which all field types have to implement to be indexable by search backends.
Definition: Indexable.php:17
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.