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

FieldRegistryPass.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Base\Container\Compiler\Search;
8
9 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
10 use Symfony\Component\DependencyInjection\ContainerBuilder;
11 use Symfony\Component\DependencyInjection\Reference;
12 use LogicException;
13
17 class FieldRegistryPass implements CompilerPassInterface
18 {
24 public function process(ContainerBuilder $container)
25 {
26 if (!$container->hasDefinition('ezpublish.search.common.field_registry')) {
27 return;
28 }
29
30 $fieldRegistryDefinition = $container->getDefinition('ezpublish.search.common.field_registry');
31
32 foreach ($container->findTaggedServiceIds('ezpublish.fieldType.indexable') as $id => $attributes) {
33 foreach ($attributes as $attribute) {
34 if (!isset($attribute['alias'])) {
35 throw new LogicException(
36 'ezpublish.fieldType.indexable service tag needs an "alias" attribute to ' .
37 'identify the indexable field type. None given.'
38 );
39 }
40
41 $fieldRegistryDefinition->addMethodCall(
42 'registerType',
43 [
44 $attribute['alias'],
45 new Reference($id),
46 ]
47 );
48 }
49 }
50 }
51 }
eZ\Publish\Core\Base\Container\Compiler\Search\FieldRegistryPass
This compiler pass will register eZ Publish indexable field types.
Definition: FieldRegistryPass.php:18
eZ\Publish\Core\Base\Container\Compiler\Search\FieldRegistryPass\process
process(ContainerBuilder $container)
Definition: FieldRegistryPass.php:24
eZ\Publish\Core\Base\Container\Compiler\Search
Definition: AggregateFieldValueMapperPass.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.