Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Commit99f60dc
committed
feature#20107 Added a build method to the kernel to replace Bundle::build() (iltar)
This PR was merged into the 3.3-dev branch.Discussion----------Added a build method to the kernel to replace Bundle::build()| Q | A || --- | --- || Branch? | master || Bug fix? | no || New feature? | yes || BC breaks? | no || Deprecations? | no || Tests pass? | yes || Fixed tickets |#20099 || License | MIT || Doc PR | ~ |Adds a DX method to make it easier to omit using an AppBundle in your application.**Old situation**``` php// src/AppBundle.phpclass AppBundle extends Bundle{ public function build(ContainerBuilder $container) { $container->addCompilerPass(new SomeCompilerPass()); $container->addCompilerPass(new AnotherCompilerPass()); $container->addCompilerPass(new YetAnotherCompilerPass()); }}// src/DependencyInjection/AppExtension.phpclass AppExtension extends Extension{ public function load(array $config, ContainerBuilder $container) { $binary = ExecutableResolver::getPath($container->getParameter('kernel.root_dir').'/../'); $snappyConfig = ['pdf' => ['binary' => realpath($binary)]]; $container->prependExtensionConfig('knp_snappy', $snappyConfig); }}```**New situation**``` php// rm src/AppBundle.php// rm src/DependencyInjection/AppExtension.php// app/AppKernel.phpclass AppKernel extends Kernel{ protected function build(ContainerBuilder $container) { $binary = ExecutableResolver::getPath($container->getParameter('kernel.root_dir').'/../'); $snappyConfig = ['pdf' => ['binary' => realpath($binary)]]; $container->prependExtensionConfig('knp_snappy', $snappyConfig); $container->addCompilerPass(new SomeCompilerPass()); $container->addCompilerPass(new AnotherCompilerPass()); $container->addCompilerPass(new YetAnotherCompilerPass()); }}```Still missing tests, wondering if worth adding in this state first.Commits-------62e80fc Added build and class cache to kernelFile tree
3 files changed
+56
-0
lines changed- src/Symfony/Component/HttpKernel
- Tests
- Fixtures
3 files changed
+56
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
469 | 480 | | |
470 | 481 | | |
471 | 482 | | |
| |||
625 | 636 | | |
626 | 637 | | |
627 | 638 | | |
| 639 | + | |
628 | 640 | | |
629 | 641 | | |
630 | 642 | | |
631 | 643 | | |
| 644 | + | |
| 645 | + | |
632 | 646 | | |
633 | 647 | | |
634 | 648 | | |
| |||
Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
725 | 726 | | |
726 | 727 | | |
727 | 728 | | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
728 | 737 | | |
729 | 738 | | |
730 | 739 | | |
| |||
0 commit comments
Comments
(0)