Skip to content

[HttpKernel] Controller Attributes #45457

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

Closed
wants to merge 2 commits into from

Conversation

codedmonkey
Copy link
Contributor

@codedmonkey codedmonkey commented Feb 17, 2022

Q A
Branch? 6.1
Bug fix? no
New feature? yes
Deprecations? no
Tickets #44705
License MIT
Doc PR symfony/symfony-docs#...

In a continuation of efforts to deprecate SensioFrameworkExtraBundle (#45415), this PR adds a mechanism to parse controller attributes at the request of @nicolas-grekas.

This is a rewrite of the ControllerListener from SensioFrameworkExtraBundle with support for annotations dropped.

The only thing I haven't implemented is a configuration option in FrameworkBundle to enable/disable support. I'm thinking of either framework.controller.controller_attributes or framework.request.controller_attributes, any suggestions?

namespace Symfony\Component\HttpKernel\Attribute;

/**
* Marker interface for controller attributes
Copy link
Contributor

Choose a reason for hiding this comment

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

For controller argument attributes we decided to remove the marker interface, should we do the same here ?

Copy link
Contributor

Choose a reason for hiding this comment

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

No marker at all, the same way controller argument metadata works. We might need to introduce a ControllerMetadata class to mirror the ArgumentMetadata one.


namespace Symfony\Component\HttpKernel\EventListener;

use Doctrine\Persistence\Proxy;
Copy link
Contributor

Choose a reason for hiding this comment

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

relevant?

@nicolas-grekas
Copy link
Member

I'm closing in favor of #46001, which should provide a better starting point for the goal we have.
Thanks for pushing this topic forward!

chalasr added a commit that referenced this pull request Jul 7, 2022
… handle attributes on controllers (nicolas-grekas)

This PR was squashed before being merged into the 6.2 branch.

Discussion
----------

[HttpKernel] Add `ControllerEvent::getAttributes()` to handle attributes on controllers

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Replacing #45457. Paving the way toward #44705

Commits
-------

0f2293c [HttpKernel] Add `ControllerEvent::getAttributes()` to handle attributes on controllers
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.

5 participants