2222 */
2323class ReplaceAliasByActualDefinitionPass implements CompilerPassInterface
2424{
25+ private $ compiler ;
26+ private $ formatter ;
27+ private $ sourceId ;
28+
2529 /**
2630 * Process the Container to replace aliases with service definitions.
2731 *
28- * @param ContainerBuilder $container
32+ * @param ContainerBuilder $container
2933 */
3034 public function process (ContainerBuilder $ container )
3135 {
36+ $ this ->compiler = $ container ->getCompiler ();
37+ $ this ->formatter = $ this ->compiler ->getLoggingFormatter ();
38+
3239 foreach ($ container ->getAliases () as $ id => $ alias ) {
3340 $ aliasId = (string ) $ alias ;
3441
@@ -67,14 +74,20 @@ private function updateReferences($container, $currentId, $newId)
6774 }
6875 }
6976
70- foreach ($ container ->getDefinitions () as $ definition ) {
77+ foreach ($ container ->getDefinitions () as $ id => $ definition ) {
78+ $ this ->sourceId = $ id ;
79+
7180 $ definition ->setArguments (
7281 $ this ->updateArgumentReferences ($ definition ->getArguments (), $ currentId , $ newId )
7382 );
7483
7584 $ definition ->setMethodCalls (
7685 $ this ->updateArgumentReferences ($ definition ->getMethodCalls (), $ currentId , $ newId )
7786 );
87+
88+ $ definition ->setProperties (
89+ $ this ->updateArgumentReferences ($ definition ->getProperties (), $ currentId , $ newId )
90+ );
7891 }
7992 }
8093
@@ -93,6 +106,7 @@ private function updateArgumentReferences(array $arguments, $currentId, $newId)
93106 } else if ($ argument instanceof Reference) {
94107 if ($ currentId === (string ) $ argument ) {
95108 $ arguments [$ k ] = new Reference ($ newId , $ argument ->getInvalidBehavior ());
109+ $ this ->compiler ->addLogMessage ($ this ->formatter ->formatUpdateReference ($ this , $ this ->sourceId , $ currentId , $ newId ));
96110 }
97111 }
98112 }
0 commit comments