1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Sylius package. |
5
|
|
|
* |
6
|
|
|
* (c) Paweł Jędrzejewski |
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 Sylius\Bundle\PromotionBundle\DependencyInjection; |
13
|
|
|
|
14
|
|
|
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension; |
15
|
|
|
use Sylius\Component\Resource\Factory\Factory; |
16
|
|
|
use Symfony\Component\Config\FileLocator; |
17
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
18
|
|
|
use Symfony\Component\DependencyInjection\Definition; |
19
|
|
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; |
20
|
|
|
use Symfony\Component\DependencyInjection\Parameter; |
21
|
|
|
use Symfony\Component\DependencyInjection\Reference; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @author Saša Stamenković <[email protected]> |
25
|
|
|
*/ |
26
|
|
|
final class SyliusPromotionExtension extends AbstractResourceExtension |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* {@inheritdoc} |
30
|
|
|
*/ |
31
|
|
|
public function load(array $config, ContainerBuilder $container) |
32
|
|
|
{ |
33
|
|
|
$config = $this->processConfiguration($this->getConfiguration($config, $container), $config); |
|
|
|
|
34
|
|
|
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
35
|
|
|
|
36
|
|
|
$this->mapFormValidationGroupsParameters($config, $container); |
37
|
|
|
|
38
|
|
|
$loader->load('services.xml'); |
39
|
|
|
$loader->load(sprintf('services/integrations/%s.xml', $config['driver'])); |
40
|
|
|
|
41
|
|
|
$this->registerResources('sylius', $config['driver'], $config['resources'], $container); |
42
|
|
|
|
43
|
|
|
$container |
44
|
|
|
->getDefinition('sylius.form.type.promotion_action') |
45
|
|
|
->replaceArgument(1, new Reference('sylius.registry_promotion_action')) |
46
|
|
|
; |
47
|
|
|
$container |
48
|
|
|
->getDefinition('sylius.form.type.promotion_rule') |
49
|
|
|
->replaceArgument(1, new Reference('sylius.registry_promotion_rule_checker')) |
50
|
|
|
; |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|
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: