Skip to content

Commit a928fa3

Browse files
committed
Merge pull request #2160 from richardmiller/correcting_di_example_order
Moving registering extension above loading config in DI code sample
2 parents 2e8bb8b + e4b9f17 commit a928fa3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

components/dependency_injection/compilation.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,11 @@ processed when the container is compiled at which point the Extensions are loade
112112
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
113113

114114
$container = new ContainerBuilder();
115+
$container->registerExtension(new AcmeDemoExtension);
116+
115117
$loader = new YamlFileLoader($container, new FileLocator(__DIR__));
116118
$loader->load('config.yml');
117119

118-
$container->registerExtension(new AcmeDemoExtension);
119120
// ...
120121
$container->compile();
121122

0 commit comments

Comments
 (0)