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

containerBuilder.php
Go to the documentation of this file.
1 <?php
2
7 use Symfony\Component\DependencyInjection\ContainerBuilder;
8 use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
9 use Symfony\Component\DependencyInjection\Reference;
10 use Symfony\Component\Config\FileLocator;
11 use eZ\Publish\Core\Base\Container\Compiler;
12 use Symfony\Component\Cache\Adapter\RedisAdapter;
13 use Symfony\Component\Config\Resource\FileResource;
14
15 if (!isset($installDir)) {
16 throw new \RuntimeException('$installDir not provided to ' . __FILE__);
17 }
18
19 $containerBuilder = new ContainerBuilder();
20
21 // Track current file for changes
22 $containerBuilder->addResource(new FileResource(__FILE__));
23
24 $settingsPath = $installDir . '/eZ/Publish/Core/settings/';
25 $loader = new YamlFileLoader($containerBuilder, new FileLocator($settingsPath));
26
27 $loader->load('fieldtype_external_storages.yml');
28 $loader->load('fieldtype_services.yml');
29 $loader->load('fieldtypes.yml');
30 $loader->load('indexable_fieldtypes.yml');
31 $loader->load('io.yml');
32 $loader->load('repository.yml');
33 $loader->load('repository/inner.yml');
34 $loader->load('repository/signalslot.yml');
35 $loader->load('repository/siteaccessaware.yml');
36 $loader->load('roles.yml');
37 $loader->load('storage_engines/common.yml');
38 $loader->load('storage_engines/cache.yml');
39 $loader->load('storage_engines/legacy.yml');
40 $loader->load('storage_engines/shortcuts.yml');
41 $loader->load('search_engines/common.yml');
42 $loader->load('settings.yml');
43 $loader->load('utils.yml');
44 $loader->load('tests/common.yml');
45 $loader->load('policies.yml');
46 $loader->load('richtext.yml');
47 $loader->load('slot.yml');
48
49 // Cache settings (takes same env variables as ezplatform does, only supports "singleredis" setup)
50 if (getenv('CUSTOM_CACHE_POOL') === 'singleredis') {
51 /*
52 * Symfony\Component\Cache\Adapter\RedisAdapter
53 * @param \Redis|\RedisArray|\RedisCluster|\Predis\Client $redisClient
54 * public function __construct($redisClient, $namespace = '', $defaultLifetime = 0)
55 *
56 * $redis = new \Redis();
57 * $redis->connect('127.0.0.1', 6379, 2.5);
58 */
59 $containerBuilder
60 ->register('ezpublish.cache_pool.driver.redis', 'Redis')
61 ->addMethodCall('connect', [(getenv('CACHE_HOST') ?: '127.0.0.1'), 6379, 2.5]);
62
63 $containerBuilder
64 ->register('ezpublish.cache_pool.driver', RedisAdapter::class)
65 ->setArguments([new Reference('ezpublish.cache_pool.driver.redis'), '', 120]);
66 }
67
68 $containerBuilder->setParameter('ezpublish.kernel.root_dir', $installDir);
69
70 $containerBuilder->addCompilerPass(new Compiler\FieldTypeCollectionPass());
71 $containerBuilder->addCompilerPass(new Compiler\FieldTypeNameableCollectionPass());
72 $containerBuilder->addCompilerPass(new Compiler\RegisterLimitationTypePass());
73
74 $containerBuilder->addCompilerPass(new Compiler\Storage\ExternalStorageRegistryPass());
75 $containerBuilder->addCompilerPass(new Compiler\Storage\Legacy\FieldValueConverterRegistryPass());
76 $containerBuilder->addCompilerPass(new Compiler\Storage\Legacy\RoleLimitationConverterPass());
77
78 $containerBuilder->addCompilerPass(new Compiler\Search\Legacy\CriteriaConverterPass());
79 $containerBuilder->addCompilerPass(new Compiler\Search\Legacy\CriterionFieldValueHandlerRegistryPass());
80 $containerBuilder->addCompilerPass(new Compiler\Search\Legacy\SortClauseConverterPass());
81
82 return $containerBuilder;
eZ\Publish\Core\Base\Container\Compiler\FieldTypeCollectionPass
This compiler pass will register eZ Publish field types.
Definition: FieldTypeCollectionPass.php:17
eZ\Publish\Core\Base\Container\Compiler\FieldTypeNameableCollectionPass
This compiler pass will register eZ Publish nameable field types.
Definition: FieldTypeNameableCollectionPass.php:17
eZ\Publish\Core\Base\Container\Compiler\RegisterLimitationTypePass
This compiler pass will register eZ Publish field types.
Definition: RegisterLimitationTypePass.php:17
$settingsPath
$settingsPath
Definition: containerBuilder.php:24
$containerBuilder
if(!isset($installDir)) $containerBuilder
Definition: containerBuilder.php:19
$loader
$loader
Definition: containerBuilder.php:25
eZ\Publish\Core\Base\Container\Compiler
Definition: FieldTypeCollectionPass.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.