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

RegisterSearchEnginePass.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler;
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 RegisterSearchEnginePass implements CompilerPassInterface
18 {
26 protected $factoryId = 'ezpublish.api.search_engine.factory';
27
35 public function process(ContainerBuilder $container)
36 {
37 if (!$container->hasDefinition($this->factoryId)) {
38 return;
39 }
40
41 $searchEngineFactoryDefinition = $container->getDefinition($this->factoryId);
42
43 foreach ($container->findTaggedServiceIds('ezpublish.searchEngine') as $id => $attributes) {
44 foreach ($attributes as $attribute) {
45 if (!isset($attribute['alias'])) {
46 throw new LogicException(
47 'ezpublish.searchEngine service tag needs an "alias" attribute to ' .
48 'identify the search engine. None given.'
49 );
50 }
51
52 // Register the search engine with the search engine factory
53 $searchEngineFactoryDefinition->addMethodCall(
54 'registerSearchEngine',
55 [
56 new Reference($id),
57 $attribute['alias'],
58 ]
59 );
60 }
61 }
62 }
63 }
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\RegisterSearchEnginePass
This compiler pass will register eZ Publish search engines.
Definition: RegisterSearchEnginePass.php:18
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\RegisterSearchEnginePass\$factoryId
$factoryId
Definition: RegisterSearchEnginePass.php:26
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\RegisterSearchEnginePass\process
process(ContainerBuilder $container)
Registers all found search engines to the SearchEngineFactory.
Definition: RegisterSearchEnginePass.php:35
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler
Definition: AsseticPass.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.