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

EzPublishRestExtension.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishRestBundle\DependencyInjection;
8
9 use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor;
10 use Symfony\Component\Config\FileLocator;
11 use Symfony\Component\Config\Resource\FileResource;
12 use Symfony\Component\DependencyInjection\ContainerBuilder;
13 use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
14 use Symfony\Component\DependencyInjection\Loader;
15 use Symfony\Component\HttpKernel\DependencyInjection\Extension;
16 use Symfony\Component\Yaml\Yaml;
17
23 class EzPublishRestExtension extends Extension implements PrependExtensionInterface
24 {
28 public function load(array $configs, ContainerBuilder $container)
29 {
30 $configuration = $this->getConfiguration($configs, $container);
31 $config = $this->processConfiguration($configuration, $configs);
32
33 $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
34 $loader->load('services.yml');
35 $loader->load('value_object_visitors.yml');
36 $loader->load('input_parsers.yml');
37 $loader->load('security.yml');
38 $loader->load('default_settings.yml');
39
40 $processor = new ConfigurationProcessor($container, 'ezsettings');
41 $processor->mapConfigArray('rest_root_resources', $config);
42 }
43
44 public function prepend(ContainerBuilder $container)
45 {
46 if ($container->hasExtension('nelmio_cors')) {
47 $file = __DIR__ . '/../Resources/config/nelmio_cors.yml';
48 $config = Yaml::parse(file_get_contents($file));
49 $container->prependExtensionConfig('nelmio_cors', $config);
50 $container->addResource(new FileResource($file));
51 }
52
53 $this->prependRouterConfiguration($container);
54 }
55
56 private function prependRouterConfiguration(ContainerBuilder $container)
57 {
58 $config = ['router' => ['default_router' => ['non_siteaccess_aware_routes' => ['ezpublish_rest_']]]];
59 $container->prependExtensionConfig('ezpublish', $config);
60 }
61 }
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor
Processor for SiteAccess aware configuration processing.
Definition: ConfigurationProcessor.php:18
eZ\Bundle\EzPublishRestBundle\DependencyInjection\EzPublishRestExtension
This is the class that loads and manages your bundle configuration.
Definition: EzPublishRestExtension.php:24
eZ\Bundle\EzPublishRestBundle\DependencyInjection\EzPublishRestExtension\prependRouterConfiguration
prependRouterConfiguration(ContainerBuilder $container)
Definition: EzPublishRestExtension.php:56
eZ\Bundle\EzPublishRestBundle\DependencyInjection\EzPublishRestExtension\load
load(array $configs, ContainerBuilder $container)
{}
Definition: EzPublishRestExtension.php:28
eZ\Bundle\EzPublishRestBundle\DependencyInjection\EzPublishRestExtension\prepend
prepend(ContainerBuilder $container)
Definition: EzPublishRestExtension.php:44
$loader
$loader
Definition: containerBuilder.php:25
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.