Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Conversation

@weaverryan
Copy link
Member

QA
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?no
Fixed ticketsPartially#15864
LicenseMIT
Doc PRnot yet

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 thatrouting_dev.yml isn'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!

Copy link
Contributor

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?

Copy link
MemberAuthor

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

@weaverryanweaverryanforce-pushed theframework_kernel_with_route_loading branch fromaa2ac38 to662ceecCompareSeptember 27, 2015 23:13
@fabpot
Copy link
Member

I don't like the mixed-responsibilities here and the fact that the kernel implements theRouteLoaderInterface and the hack to make it work. We already have everything you need in Symfony today to make it simpler and cleaner (hopefully :)):

<?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
Copy link
Member

Of course, my example does not work in PHP 5.3, but adding a$that = $this would be enough to make compatible.

@fabpot
Copy link
Member

I'm going to submit a PR soon with my own version of a micro-kernel.

@fabpot
Copy link
Member

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
Copy link
Member

see#15990

Copy link
Member

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.

@fabpotfabpot mentioned this pull requestSep 29, 2015
@fabpot
Copy link
Member

Closes in favor of#15990

@fabpotfabpot closed thisOct 1, 2015
@weaverryanweaverryan deleted the framework_kernel_with_route_loading branchOctober 1, 2015 21:15
fabpot added a commit that referenced this pull requestNov 5, 2015
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
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@weaverryan@fabpot@1ed@wouterj@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp