10000 (Un)setting pre-defined services is now deprecated · Issue #7464 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

(Un)setting pre-defined services is now deprecated #7464

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
javiereguiluz opened this issue Feb 12, 2017 · 3 comments
Closed

(Un)setting pre-defined services is now deprecated #7464

javiereguiluz opened this issue Feb 12, 2017 · 3 comments

Comments

@javiereguiluz
Copy link
Member

See symfony/symfony#21533

By the way, the "pre-defined services" name could be improved. I don't know what does it mean exactly.

@linaori
Copy link
Contributor
linaori commented Mar 23, 2017

Some info if someone feels like writing docs about this issue:

I've done some digging and the name is correct, however, something like compiled service would also be possible. For those who are not familiar with it: This PR makes it impossible to change a pre-defined service. A predefined service, is a service that is registered in the methodMap property in the container. This is a key value array where the key is the service id, and the value is the method in the container to return that service.

Example:

class SomeContainer extends Container
{
    private $methodMap = [
        'foo.baz' => 'getFoo_BazService',
    ];

    protected function getFoo_BazService()
    {
        return new FooBaz();
    }
    // ...
}

When calling $container->set('foo.baz', ...);, it will now register that service instance internally: $this->services[$id] = $service;. If I understand this PR correctly, 4.0 will no longer make this possible if this service is pre-defined (aka, available in the compiled/extended container).

Correct me if I'm wrong! /cc @nicolas-grekas

@nicolas-grekas
Copy link
Member

Duplicate of #8203 (or the other way around?)

@xabbuh
Copy link
Member
xabbuh commented Sep 28, 2017

closing here in favour of #8203 (the other issue seems to contain more information for someone who wants to work on this)

@xabbuh xabbuh closed this as completed Sep 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0