|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Superdesk Web Publisher Content Bundle. |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright 2015 Sourcefabric z.u. and contributors. |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please see the |
|
9
|
|
|
* AUTHORS and LICENSE files distributed with this source code. |
|
10
|
|
|
* |
|
11
|
|
|
* @copyright 2015 Sourcefabric z.ú |
|
12
|
|
|
* @license http://www.superdesk.org/license |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
namespace SWP\Bundle\ContentBundle\DependencyInjection; |
|
16
|
|
|
|
|
17
|
|
|
use SWP\Bundle\StorageBundle\Drivers; |
|
18
|
|
|
use SWP\Bundle\StorageBundle\DependencyInjection\Extension\Extension; |
|
19
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
20
|
|
|
use Symfony\Component\Config\FileLocator; |
|
21
|
|
|
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; |
|
22
|
|
|
use Symfony\Component\DependencyInjection\Loader; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* This is the class that loads and manages your bundle configuration. |
|
26
|
|
|
* |
|
27
|
|
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} |
|
28
|
|
|
*/ |
|
29
|
|
|
class SWPContentExtension extends Extension implements PrependExtensionInterface |
|
30
|
|
|
{ |
|
31
|
|
|
/** |
|
32
|
|
|
* {@inheritdoc} |
|
33
|
1 |
|
*/ |
|
34
|
|
|
public function load(array $configs, ContainerBuilder $container) |
|
35
|
1 |
|
{ |
|
36
|
1 |
|
$config = $this->processConfiguration(new Configuration(), $configs); |
|
37
|
1 |
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
38
|
|
|
$loader->load('services.yml'); |
|
39
|
1 |
|
|
|
40
|
1 |
|
if ($config['persistence']['orm']['enabled']) { |
|
41
|
1 |
|
$this->registerStorage(Drivers::DRIVER_DOCTRINE_ORM, $config['persistence']['orm']['classes'], $container); |
|
42
|
|
|
$loader->load('providers.orm.yml'); |
|
43
|
1 |
|
} |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function prepend(ContainerBuilder $container): void |
|
47
|
|
|
{ |
|
48
|
|
|
$config = [ |
|
49
|
|
|
[ |
|
50
|
|
|
'adapters' => [ |
|
51
|
|
|
'fallback_adapter' => [ |
|
52
|
|
|
'fallback' => [ |
|
53
|
|
|
'mainAdapter' => '%env(resolve:FS_MAIN_ADAPTER)%', |
|
54
|
|
|
'fallback' => 'local_adapter', |
|
55
|
|
|
'forceCopyOnMain' => false, |
|
56
|
|
|
], |
|
57
|
|
|
], |
|
58
|
|
|
], |
|
59
|
|
|
], |
|
60
|
|
|
]; |
|
61
|
|
|
|
|
62
|
|
|
$config = $container->resolveEnvPlaceholders( |
|
63
|
|
|
$config, |
|
64
|
|
|
true |
|
|
|
|
|
|
65
|
|
|
); |
|
66
|
|
|
|
|
67
|
|
|
$container->prependExtensionConfig('oneup_flysystem', $config[0]); |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: