Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[WIP] Route building in the kernel#15948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Seems like some test code left here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I definitely did - fixed now
aa2ac38 to662ceecCompare662ceec to62f0ba6Comparefabpot commentedSep 29, 2015
I don't like the mixed-responsibilities here and the fact that the kernel implements the <?phpnamespaceSymfony\Bundle\FrameworkBundle\Kernel;useSymfony\Bundle\FrameworkBundle\Routing\RouteCollectionBuilder;useSymfony\Component\Config\Loader\LoaderInterface;useSymfony\Component\DependencyInjection\ContainerBuilder;useSymfony\Component\HttpKernel\MicroKernelasBaseMicroKernel;abstractclass MicroKernelextends BaseMicroKernel{abstractprotectedfunctionconfigureRoutes(RouteCollectionBuilder$routes);publicfunctionregisterContainerConfiguration(LoaderInterface$loader) {$loader->load(function (ContainerBuilder$container)use ($loader) {$container->prependExtensionConfig('framework',array('router' =>array('resource' =>function ()use ($loader) {return$this->configureRoutes(newRouteCollectionBuilder($loader))->build(); },'type' =>'closure', ), )); });parent::registerContainerConfiguration($loader); }} |
fabpot commentedSep 29, 2015
Of course, my example does not work in PHP 5.3, but adding a |
fabpot commentedSep 29, 2015
I'm going to submit a PR soon with my own version of a micro-kernel. |
fabpot commentedSep 29, 2015
That does not work right now in Symfony as we try to dump the container to PHP (and XML in dev mode); so the router resource being a closure, it explodes. |
fabpot commentedSep 29, 2015
see#15990 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
loadFromExtension is enough here as we are always the first to be called.
fabpot commentedOct 1, 2015
Closes in favor of#15990 |
This PR was merged into the 2.8 branch.Discussion----------added a micro kernel| Q | A| ------------- | ---| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | n/a| License | MIT| Doc PR | n/aRelated to#15948 and#15820Commits-------eab0f0a added a micro kernel
WIP, because it depends on the unmerged PR's#15742,#15778 and#15820. But since this completes the picture (and I'm pushing this for 2.8), I needed to get this PR created.
The idea is to make a "normal" kernel look like this:https://gist.github.com/weaverryan/e4b19cabb1d9286c4217#file-smallkernel-php, which has some nice benefit that
routing_dev.ymlisn't needed anymore, because you can import those routes conditionally here.But, you could also create an entire kernel without external files. A complex example (probably more complex than you'd have without using external files) is here:https://gist.github.com/weaverryan/e4b19cabb1d9286c4217#file-appkernel-php.
Thanks!