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

Appearance settings

[DI] Dumping shared private service is deprecated? #19680

Copy link
Copy link
Closed
@ro0NL

Description

@ro0NL
Issue body actions

Consider the following container;

$container = new ContainerBuilder();
$container->register('shared_private', 'stdClass')
    ->setPublic(false);
$container->register('shared_private_dep1', 'stdClass')
    ->setProperty('dep', new Reference('shared_private'));
// container is not compiled
$dumper= new PhpDumper($container);
$dump = $dumper->dump();

$dump looks like;

class PreCompile extends Container
{
    public function __construct()
    {
        parent::__construct();
        $this->methodMap = array(
            'shared_private' => 'getSharedPrivateService',
            'shared_private_dep1' => 'getSharedPrivateDep1Service',
        );
        $this->privates = array(
            'shared_private' => true,
        );
    }

    protected function getSharedPrivateDep1Service()
    {
        $this->services['shared_private_dep1'] = $instance = new \stdClass();

        $instance->dep = $this->get('shared_private');

        return $instance;
    }

    protected function getSharedPrivateService()
    {
        return $this->services['shared_private'] = new \stdClass();
    }
}

Calling $dumpedContainer->get('shared_private_dep1') gives

Requesting the "shared_private" private service is deprecated since Symfony 3.2 and won't be supported anymore in Symfony 4.0:

I've got something running on this, but i want to be sure this doesnt work as intented currently.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

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