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

Documented the new kernel.controller_arguments event#6434

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

@javiereguiluz
Copy link
Member

QA
Doc fix?no
New docs?yes
Applies tomaster (3.1+)
Fixed ticketssymfony/symfony#18440

linaori and OskarStark reacted with thumbs up emoji
fabpot added a commit to symfony/symfony that referenced this pull requestApr 7, 2016
This PR was merged into the 3.1-dev branch.Discussion----------Add the kernel.controller_arguments event| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#18362| License       | MIT| Doc PR        |symfony/symfony-docs#6434I'm not sure this can be integrated in 3.1 due to the feature freeze, but it would be great if it is, as it is a must-have to be able to make the ``@Security`` annotation compatible with the new argument resolver system (as we need to be able to run the security assertion after the resolving).I made the arguments mutable here for consistency with ``kernel.controller`` (and@fabpot replied LGTM in the RFC when I suggested it).Commits-------af02e2a Add the kernel.controller_arguments event
The ``kernel.controller_arguments`` event was introduced in Symfony 3.1.

Once controller arguments have been resolved by Symfony, the ``kernel.controller_arguments``
event is triggered. This allows to modify or replace the arguments to fit your
Copy link
Member

Choose a reason for hiding this comment

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

it now also allows to replace the controller

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I've reworded this. Thanks!

symfony-splitter pushed a commit to symfony/http-kernel that referenced this pull requestApr 7, 2016
This PR was merged into the 3.1-dev branch.Discussion----------Add the kernel.controller_arguments event| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | #18362| License       | MIT| Doc PR        |symfony/symfony-docs#6434I'm not sure this can be integrated in 3.1 due to the feature freeze, but it would be great if it is, as it is a must-have to be able to make the ``@Security`` annotation compatible with the new argument resolver system (as we need to be able to run the security assertion after the resolving).I made the arguments mutable here for consistency with ``kernel.controller`` (and@fabpot replied LGTM in the RFC when I suggested it).Commits-------af02e2a Add the kernel.controller_arguments event
@xabbuhxabbuh added this to the3.1 milestoneApr 10, 2016
@xabbuhxabbuh changed the title[WCM] Documented the new kernel.controller_arguments eventDocumented the new kernel.controller_arguments eventApr 10, 2016

This event can be an entry point used to modify the arguments of the controller
once they have been resolved by Symfony::

Copy link
Contributor

Choose a reason for hiding this comment

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

namespace is missing, otherwise its not very clear where to put this method IMO

Copy link
Member

Choose a reason for hiding this comment

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

you can put it where you want (as long as you tell Symfony that this method is a listener for this event) .

And the current proposal is consistent with other snippets in the page

@javiereguiluz
Copy link
MemberAuthor

I've made the requested changes. Another PR ready to be merged. Thanks!


**Event Class**::class:`Symfony\\Component\\HttpKernel\\Event\\FilterControllerArgumentsEvent`

This event can be an entry point used to modify the arguments of the controller
Copy link
Member

Choose a reason for hiding this comment

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

I would remove "an entry point".

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Fixed. Thanks.

@xabbuh
Copy link
Member

👍

@javiereguiluz
Copy link
MemberAuthor

After the last fixes, this is ready to be merged. Thanks!

@wouterj
Copy link
Member

This is probably the most confusing feature of Symfony 3.1 and that's already visible in this PR: Replacing arguments isnot the main reason for this new event.

This new event is triggered after arguments are resolved, so some logic can be executed based on these arguments. For instance, the@Security annotation will resolve the expressions during this event (expressions can use the arguments).

If you want to replace arguments, writing a custom ArgumentValueResolver is the way to go (after that PR is merged, we should definitely reference it in this section).

@stof
Copy link
Member

A use case to replace arguments is when you want to replace both the controller and the argument, after resolution of the original arguments (because your new controller is a closure wrapping the original controller). This was the use case brought by@fabpot (for a Blackfire use case IIRC) to allow replacing the controller in this event as well.

@wouterj
Copy link
Member

Status: Needs Work

@javiereguiluz
Copy link
MemberAuthor

@wouterj I can't finish this PR. If you or any other volunteer can finish it, please take over this PR. Thanks.

@javiereguiluz
Copy link
MemberAuthor

Closing it because I can't finish it. I've opened an issue related to this:#6854.

@javiereguiluzjaviereguiluz deleted the controller_args_event branchMay 24, 2018 16:04
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

3.1

Development

Successfully merging this pull request may close these issues.

6 participants

@javiereguiluz@xabbuh@wouterj@stof@OskarStark@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp