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

ElasticsearchEngineFactory.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishElasticsearchSearchEngineBundle\ApiLoader;
8
9 use eZ\Bundle\EzPublishCoreBundle\ApiLoader\RepositoryConfigurationProvider;
10 use eZ\Bundle\EzPublishElasticsearchSearchEngineBundle\DependencyInjection\EzPublishElasticsearchSearchEngineExtension;
11 use Symfony\Component\DependencyInjection\ContainerAwareInterface;
12 use Symfony\Component\DependencyInjection\ContainerAwareTrait;
13
14 class ElasticsearchEngineFactory implements ContainerAwareInterface
15 {
16 use ContainerAwareTrait;
17
19 private $repositoryConfigurationProvider;
20
22 private $defaultConnection;
23
25 private $searchEngineClass;
26
27 public function __construct(
28 RepositoryConfigurationProvider $repositoryConfigurationProvider,
29 $defaultConnection,
30 $searchEngineClass
31 ) {
32 $this->repositoryConfigurationProvider = $repositoryConfigurationProvider;
33 $this->defaultConnection = $defaultConnection;
34 $this->searchEngineClass = $searchEngineClass;
35 }
36
37 public function buildEngine()
38 {
39 $repositoryConfig = $this->repositoryConfigurationProvider->getRepositoryConfig();
40
41 $connection = $this->defaultConnection;
42 if (isset($repositoryConfig['search']['connection'])) {
43 $connection = $repositoryConfig['search']['connection'];
44 }
45
46 return new $this->searchEngineClass(
47 $this->container->get(sprintf('%s.%s', EzPublishElasticsearchSearchEngineExtension::CONTENT_SEARCH_GATEWAY_ID, $connection)),
48 $this->container->get(sprintf('%s.%s', EzPublishElasticsearchSearchEngineExtension::LOCATION_SEARCH_GATEWAY_ID, $connection)),
49 $this->container->get('ezpublish.search.elasticsearch.mapper'),
50 $this->container->get('ezpublish.search.elasticsearch.extractor'),
51 $this->container->getParameter("ez_search_engine_elasticsearch.connection.$connection.location_document_type_identifier"),
52 $this->container->getParameter("ez_search_engine_elasticsearch.connection.$connection.location_document_type_identifier")
53 );
54 }
55 }
eZ\Bundle\EzPublishCoreBundle\ApiLoader\RepositoryConfigurationProvider
The repository configuration provider.
Definition: RepositoryConfigurationProvider.php:16
eZ\Bundle\EzPublishElasticsearchSearchEngineBundle\ApiLoader\ElasticsearchEngineFactory
Definition: ElasticsearchEngineFactory.php:15
eZ\Bundle\EzPublishElasticsearchSearchEngineBundle\ApiLoader\ElasticsearchEngineFactory\__construct
__construct(RepositoryConfigurationProvider $repositoryConfigurationProvider, $defaultConnection, $searchEngineClass)
Definition: ElasticsearchEngineFactory.php:27
eZ\Bundle\EzPublishElasticsearchSearchEngineBundle\ApiLoader\ElasticsearchEngineFactory\$defaultConnection
$defaultConnection
Definition: ElasticsearchEngineFactory.php:22
eZ\Bundle\EzPublishElasticsearchSearchEngineBundle\ApiLoader\ElasticsearchEngineFactory\$searchEngineClass
$searchEngineClass
Definition: ElasticsearchEngineFactory.php:25
eZ\Bundle\EzPublishElasticsearchSearchEngineBundle\ApiLoader\ElasticsearchEngineFactory\buildEngine
buildEngine()
Definition: ElasticsearchEngineFactory.php:37
eZ\Bundle\EzPublishElasticsearchSearchEngineBundle\ApiLoader\ElasticsearchEngineFactory\$repositoryConfigurationProvider
$repositoryConfigurationProvider
Definition: ElasticsearchEngineFactory.php:19
eZ\Bundle\EzPublishElasticsearchSearchEngineBundle\DependencyInjection\EzPublishElasticsearchSearchEngineExtension
Definition: EzPublishElasticsearchSearchEngineExtension.php:17
eZ\Bundle\EzPublishElasticsearchSearchEngineBundle\DependencyInjection\EzPublishElasticsearchSearchEngineExtension\CONTENT_SEARCH_GATEWAY_ID
const CONTENT_SEARCH_GATEWAY_ID
Definition: EzPublishElasticsearchSearchEngineExtension.php:20
eZ\Bundle\EzPublishElasticsearchSearchEngineBundle\DependencyInjection\EzPublishElasticsearchSearchEngineExtension\LOCATION_SEARCH_GATEWAY_ID
const LOCATION_SEARCH_GATEWAY_ID
Definition: EzPublishElasticsearchSearchEngineExtension.php:21
eZ\Bundle\EzPublishElasticsearchSearchEngineBundle\ApiLoader
Definition: ElasticsearchEngineFactory.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.