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

[2.8] Move argument resolving from ControllerResolver#14971

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

Closed
wouterj wants to merge9 commits intosymfony:2.8fromwouterj:pr_11457

Conversation

@wouterj
Copy link
Member

Description

Thiscloses#11457. Changes since that PR:

  • The ControllerResolver has a new methodsetArgumentResolver, too keep BC with people overridingControllerResolver#doGetArguments
  • Deprecations instead of removal, so it can be merged into 2.8
  • Added 2 new argument resolvers: A Security user resolver (which was the original problem to create this PR) and a PSR Request resolver

PR Info Table

QA
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?yes
Tests pass?yes
Fixed tickets#1547,#10710
LicenseMIT
Doc PRtbd

Todo

  • Add priority (is this actually needed?)
  • Make tests pass
  • Update docs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

maybe2.8?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

BTW deprecation errors now comes with@ operator

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks, both mistakes are fixed now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think this can be confused if we want to resolve User by ParamConverter ?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Sorry, I'm not sure I understand what you try to say.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hmm, do you mean using the Doctrine Param Converter? That's why I made this resolver only work withUserInterface. When using the Doctrine Param Converter, one would actually need to typehint to a specific implementation.

Btw, this may be a good reason to implement priority for argument resolvers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

yes I mean Doctrine Param Converter and implement priority sound good to me.

@fabpot
Copy link
Member

I would be interested in having measures in terms of performance impact of these changes.

@wouterj
Copy link
MemberAuthor

Unfortunately, I can't make benchmarks using Blackfire on my Windows PC. The timeline in the profiler doesn't show much difference between applying this PR and using the 2.8 branch.

I would appreciate if someone with a Linux machine could run some benchmarks using blackfire on this :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

there should also be a config setting to force disabling it in case you don't want to use the parameter converter, allowing to get rid of its overhead

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

In that case, we should have a configure option for all resolvers imo (so one config option in SecurityBundle too). I'm not sure I like that.

@stof
Copy link
Member

and all the argument resolvers are missing their test coverage

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

if (!$container->has($this->managerService)

@henrikbjorn
Copy link
Contributor

@wouterj how far along is this? Also could the Argument resolvement be put into a seperate repository so we can play around with it (want to use some in Silex context)

@wouterj
Copy link
MemberAuthor

@henrikbjorn imo, it's just waiting for someone with an UNIX based PC to benchmark it properly (I'm on Windows).

If you want to play around with it, you can do something like this in a Silex test app:

$ composer require "symfony/symfony"$ cd vendor/symfony$ rm -rf symfony$ git clone http://github.com/WouterJ/symfony$ git checkout -b pr_11457

@henrikbjorn
Copy link
Contributor

Well im am on a Mac, so i could benchmark it if you have instructions on how to do so.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

If i create a ControllerResolver and use the methodsetArgumentResolverManager on it to set the manager directly on the resolver, and i then do not give HttpKernel an instance of that manager, the HttpKernel class will set it and overwrite the correct bootstrapping that was done.

Is there a purpose for having this code here?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

TheControllerResolver#setArgumentResolverManager() method is tagged as@internal, which means you shouldn't use it in your own code. It only exists, so we can call it here in the HttpKernel.

This is to be BC. In 3.0,ControllerResolver#setArgumentResolverManager() will be removed and the complete argument resolving part will be called by HTTP kernel directly (ControllerResolver will only resolve the controller then). So if you want to add custom argument resolvers, do it by customizing HttpKernel instead of ControllerResolver.

@wouterj
Copy link
MemberAuthor

I think a good benchmark would be to fork the standard edition and create 2 controllers (doing nothing more than returning a response): One controller with no arguments and one controller with some arguments (e.g.(Request $request, $someRoutePlaceholder)).

These 2 controllers then should be benchmarked with Blackfire (for instance) against the current 2.8 codebase and the code base of this PR.

@henrikbjorn
Copy link
Contributor

I dont want to do stuff with Blackfire!
If there is an alternative solution (terminal based) i am all for helping.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Maybe this would be better suited in the Component?

@Koc
Copy link
Contributor

Koc commentedOct 1, 2015

So does only missing performance test blocks merging this PR?

//cc@fabpot

@fabpot
Copy link
Member

@Koc Performance testing is indeed blocking this PR.

@Koc
Copy link
Contributor

Koc commentedDec 11, 2015

Sad that this PR wouldn't merged.@wouterj has maked awesome work.

@wouterj
Copy link
MemberAuthor

Well, I left my branch in my fork, so if someone has the time and energy to benchmark + improve this PR, feel free to base your contributions on my branch. For now, I don't have time and resources to work on this PR.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

10 participants

@wouterj@fabpot@stof@henrikbjorn@Koc@hhamon@rybakit@sstok@aitboudad@xabbuh

[8]ページ先頭

©2009-2025 Movatter.jp