1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the puli/symfony-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) Bernhard Schussek <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Puli\SymfonyBundle\DependencyInjection; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Config\FileLocator; |
15
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
16
|
|
|
use Symfony\Component\DependencyInjection\Loader; |
17
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @since 1.0 |
21
|
|
|
* |
22
|
|
|
* @author Bernhard Schussek <[email protected]> |
23
|
|
|
*/ |
24
|
|
|
class PuliExtension extends Extension |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* {@inheritdoc} |
28
|
|
|
*/ |
29
|
3 |
|
public function load(array $configs, ContainerBuilder $container) |
30
|
|
|
{ |
31
|
3 |
|
$bundles = $container->getParameter('kernel.bundles'); |
32
|
|
|
|
33
|
3 |
|
$configuration = $this->getConfiguration($configs, $container); |
34
|
3 |
|
$config = $this->processConfiguration($configuration, $configs); |
|
|
|
|
35
|
|
|
|
36
|
3 |
|
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
37
|
3 |
|
$loader->load('services.xml'); |
38
|
|
|
|
39
|
|
|
if (method_exists('Symfony\Component\DependencyInjection\Definition', 'setFactory')) { |
40
|
|
|
$loader->load('services-2.7.xml'); |
41
|
|
|
} else { |
42
|
|
|
$loader->load('services-2.6.xml'); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
$twigBundleLoaded = isset($bundles['TwigBundle']); |
46
|
|
|
$twigExtensionLoaded = class_exists('Puli\TwigExtension\PuliExtension'); |
47
|
|
|
$twigEnabled = $config['twig']; |
48
|
|
|
|
49
|
|
|
if ($twigBundleLoaded && $twigExtensionLoaded && $twigEnabled) { |
50
|
|
|
$loader->load('twig.xml'); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
$this->addClassesToCompile(array( |
54
|
|
|
'Puli\Discovery\AbstractEditableDiscovery', |
55
|
|
|
'Puli\Discovery\Api\Binding\Binding', |
56
|
|
|
'Puli\Discovery\Api\Binding\Initializer\BindingInitializer', |
57
|
|
|
'Puli\Discovery\Api\Discovery', |
58
|
|
|
'Puli\Discovery\Api\EditableDiscovery', |
59
|
|
|
'Puli\Repository\AbstractJsonRepository', |
60
|
|
|
'Puli\Repository\AbstractRepository', |
61
|
|
|
'Puli\Repository\AbstractEditableRepository', |
62
|
|
|
'Puli\Repository\Api\ChangeStream\ChangeStream', |
63
|
|
|
'Puli\Repository\Api\EditableRepository', |
64
|
|
|
'Puli\Repository\Api\ResourceRepository', |
65
|
|
|
'Puli\Repository\Api\Resource\BodyResource', |
66
|
|
|
'Puli\Repository\Api\Resource\FilesystemResource', |
67
|
|
|
'Puli\Repository\Api\Resource\PuliResource', |
68
|
|
|
'Puli\Repository\Api\Resource\ResourceMetadata', |
69
|
|
|
'Puli\Repository\OptimizedJsonRepository', |
70
|
|
|
'Puli\Repository\Resource\AbstractFilesystemResource', |
71
|
|
|
'Puli\Repository\Resource\FileResource', |
72
|
|
|
'Puli\Repository\Resource\GenericResource', |
73
|
|
|
)); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|
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: