Closed
Description
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.