@@ -34,6 +34,7 @@ public function process(ContainerBuilder $container)
34
34
}
35
35
$ definitions ->insert (array ($ id , $ definition ), array ($ decorated [2 ], --$ order ));
36
36
}
37
+ $ decoratingDefinitions = array ();
37
38
38
39
foreach ($ definitions as list ($ id , $ definition )) {
39
40
list ($ inner , $ renamedId ) = $ definition ->getDecoratedService ();
@@ -53,18 +54,25 @@ public function process(ContainerBuilder $container)
53
54
$ container ->setAlias ($ renamedId , new Alias ($ container ->normalizeId ($ alias ), false ));
54
55
} else {
55
56
$ decoratedDefinition = $ container ->getDefinition ($ inner );
56
- $ definition ->setTags (array_merge ($ decoratedDefinition ->getTags (), $ definition ->getTags ()));
57
- if ($ types = array_merge ($ decoratedDefinition ->getAutowiringTypes (false ), $ definition ->getAutowiringTypes (false ))) {
58
- $ definition ->setAutowiringTypes ($ types );
59
- }
60
57
$ public = $ decoratedDefinition ->isPublic ();
61
58
$ private = $ decoratedDefinition ->isPrivate ();
62
59
$ decoratedDefinition ->setPublic (false );
63
- $ decoratedDefinition ->setTags (array ());
64
- if ($ decoratedDefinition ->getAutowiringTypes (false )) {
65
- $ decoratedDefinition ->setAutowiringTypes (array ());
66
- }
67
60
$ container ->setDefinition ($ renamedId , $ decoratedDefinition );
61
+ $ decoratingDefinitions [$ inner ] = $ decoratedDefinition ;
62
+ }
63
+
64
+ if (isset ($ decoratingDefinitions [$ inner ])) {
65
+ $ decoratingDefinition = $ decoratingDefinitions [$ inner ];
66
+ $ definition ->setTags (array_merge ($ decoratingDefinition ->getTags (), $ definition ->getTags ()));
67
+ $ autowiringTypes = $ decoratingDefinition ->getAutowiringTypes (false );
68
+ if ($ types = array_merge ($ autowiringTypes , $ definition ->getAutowiringTypes (false ))) {
69
+ $ definition ->setAutowiringTypes ($ types );
70
+ }
71
+ $ decoratingDefinition ->setTags (array ());
72
+ if ($ autowiringTypes ) {
73
+ $ decoratingDefinition ->setAutowiringTypes (array ());
74
+ }
75
+ $ decoratingDefinitions [$ inner ] = $ definition ;
68
76
}
69
77
70
78
$ container ->setAlias ($ inner , $ id )->setPublic ($ public )->setPrivate ($ private );
0 commit comments