Skip to content

Navigation Menu

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

Appearance settings

[HttpKernel] Allow tagged controllers in ControllerResolver #53985

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 26, 2024
Merged

[HttpKernel] Allow tagged controllers in ControllerResolver #53985

merged 1 commit into from
Feb 26, 2024

Conversation

marein
Copy link
Contributor

@marein marein commented Feb 17, 2024

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #52471
License MIT

If the request attribute _check_controller_is_allowed is set, only TemplateController, children of AbstractController and controllers that have the attribute #[AsController] are allowed by default. This change also adds controllers tagged with controller.service_arguments to the mix. It allows them to be used with different fragment renderers (e.g. esi and ssi) without having to add any of the above conditions.

This pull request is a follow up of this discussion.

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.1 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@nicolas-grekas
Copy link
Member

Thanks for the PR. Did you consider adding the logic to RegisterControllerArgumentLocatorsPass instead of adding a new pass?

@nicolas-grekas nicolas-grekas modified the milestones: 7.0, 6.4 Feb 19, 2024
@marein
Copy link
Contributor Author

marein commented Feb 19, 2024

Yes, but since RegisterControllerArgumentLocatorsPass is already quite complex, its functionality seems independent and there's no performance penalty, I moved it to a new class. But I just took another look at it and saw that a few cases are missing in the new pass, e.g. $class = $parameterBag->resolveValue($class);. I don't have a strong opinion, so I'd roll with your suggestion.

@nicolas-grekas
Copy link
Member

I'm for moving this into RegisterControllerArgumentLocatorsPass and adding tests only to the HttpKernel components, so that we don't have cross-packages issues in the CI. Works for you?

@marein
Copy link
Contributor Author

marein commented Feb 20, 2024

Done. Failing 8.3 test shouldn't be related. I'd suggest adding a functional test, like in the first commit, to FrameworkBundle in 7.1 as this would have caught the bug. Let me know if I should open a pull request once everything is merged.

Should I fix the fabbot.io suggestion? It's unrelated to the changes. Guess it's safe to do so.

@nicolas-grekas
Copy link
Member

Let's ignore fabbot indeed here. Can you please rebase for 6.4? Then OK for me for the integration tests. You'll then need to bump http-kernel to ^6.4.4 in the composer.json of framework-bundle

@marein marein changed the base branch from 7.0 to 6.4 February 20, 2024 19:58
@nicolas-grekas
Copy link
Member

Thank you @marein.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.