Skip to content
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

[HttpKernel] add deprecation for controller:method syntax in ServiceValueResolver #36010

Conversation

noemi-salaun
Copy link
Contributor

Q A
Branch? 4.1
Bug fix? no
New feature? no
Deprecations? yes
Tickets See #35909
License MIT
Doc PR N/A

I apologize in advance, I am not fluent in English

Single colon syntax when referencing a controller as a service is deprecated since Symfony 4.1 but there was no deprecations trigger on runtime.

I found the problem trying to understand the issue #35909

By using Symfony, people have become accustomed to having all the deprecations reported in runtime.

The problem only affects controllers who need to have a service injected as a method argument.

It looks like the deprecation for the controller without injected service argument will be deprecate on v5.1. It seems weird not to deprecate these 2 cases at the same time.

In Symfony\Component\HttpKernel\Controller\ContainerControllerResolver, line 35

    protected function createController($controller)
    {
        if (1 === substr_count($controller, ':')) {
            $controller = str_replace(':', '::', $controller);
            // TODO deprecate this in 5.1
        }

        return parent::createController($controller);
    }

TODO

@noemi-salaun noemi-salaun changed the title [HttpKernel] add deprecation for controler:method syntax in ServiceValueResolver [HttpKernel] add deprecation for controller:method syntax in ServiceValueResolver Mar 9, 2020
@noemi-salaun noemi-salaun force-pushed the deprecation/add-deprecation-controller-single-colon branch from f35855a to aa11885 Compare March 9, 2020 23:12
@Tobion
Copy link
Member

Tobion commented Mar 10, 2020

4.1 is not maintained anymore. Please target 4.4, see https://symfony.com/releases

@stof
Copy link
Member

stof commented Mar 10, 2020

this notation has been un-deprecated in a 4.1 patch release because of the impact on the ecosystem (when trying to support both the 3.4 LTS and 4.x)

@noemi-salaun noemi-salaun changed the base branch from 4.1 to 4.4 March 10, 2020 17:18
…alueResolver

Single colon syntax when referencing a controller as a service
is deprecated since Symfony 4.1 but there was no deprecations
trigger on runtime.

See symfony#35909
@noemi-salaun noemi-salaun force-pushed the deprecation/add-deprecation-controller-single-colon branch from aa11885 to 4906492 Compare March 10, 2020 17:24
@noemi-salaun
Copy link
Contributor Author

Updated to target v4.4

@stof
Even if the functionality has been un-deprecated, the support is still removed in Symfony 5.0 as the issue #35909 showed

@noemi-salaun
Copy link
Contributor Author

Apparently it was a bug in v5.0. The feature wasn't fully undeprecated.
See @nicolas-grekas comment #35909 (comment)

This PR is no longer relevant.

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.

None yet

4 participants