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

BinaryContentDownloadPass.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
16 class BinaryContentDownloadPass implements CompilerPassInterface
17 {
18 public function process(ContainerBuilder $container)
19 {
20 if (!$container->has('ezpublish.fieldType.ezbinarybase.download_url_generator')) {
21 return;
22 }
23
24 $downloadUrlReference = new Reference('ezpublish.fieldType.ezbinarybase.download_url_generator');
25
26 $this->addCall($container, $downloadUrlReference, 'ezpublish.fieldType.ezmedia.externalStorage');
27 $this->addCall($container, $downloadUrlReference, 'ezpublish.fieldType.ezbinaryfile.externalStorage');
28 }
29
30 private function addCall(ContainerBuilder $container, Reference $reference, $targetServiceName)
31 {
32 if (!$container->has($targetServiceName)) {
33 return;
34 }
35
36 $definition = $container->findDefinition($targetServiceName);
37 $definition->addMethodCall('setDownloadUrlGenerator', [$reference]);
38 }
39 }
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\BinaryContentDownloadPass
Injects the downloadUrlGenerator into the binary fieldtype external storage services.
Definition: BinaryContentDownloadPass.php:17
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\BinaryContentDownloadPass\process
process(ContainerBuilder $container)
Definition: BinaryContentDownloadPass.php:18
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\BinaryContentDownloadPass\addCall
addCall(ContainerBuilder $container, Reference $reference, $targetServiceName)
Definition: BinaryContentDownloadPass.php:30
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler
Definition: AsseticPass.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.