diff --git a/core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php b/core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php index 9fe3e29..3cfb083 100644 --- a/core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php +++ b/core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php @@ -90,9 +90,12 @@ public function build($class_name) { // The actual class; $properties = <<<'EOS' /** + * Public for \Drupal\Core\DependencyInjection\DependencySerializationTrait. + * * @var string */ -protected $serviceId; +public $_serviceId; + /** * @var \{{ class_name }} @@ -163,7 +166,7 @@ protected function buildLazyLoadItselfMethod() { protected function lazyLoadItself() { if (!isset($this->service)) { - $method_name = 'get' . Container::camelize($this->serviceId) . 'Service'; + $method_name = 'get' . Container::camelize($this->_serviceId) . 'Service'; $this->service = $this->container->$method_name(false); } @@ -291,7 +294,7 @@ protected function buildConstructorMethod() { public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container, $serviceId) { $this->container = $container; - $this->serviceId = $serviceId; + $this->_serviceId = $serviceId; } EOS; diff --git a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php b/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php index cab3fb1..fd50287 100644 --- a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php +++ b/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php @@ -244,9 +244,11 @@ class {{ proxy_class }}{{ interface_string }} { /** + * Public for \Drupal\Core\DependencyInjection\DependencySerializationTrait. + * * @var string */ - protected $serviceId; + public $_serviceId; /** * @var \{{ class }} @@ -263,13 +265,13 @@ class {{ proxy_class }}{{ interface_string }} public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container, $serviceId) { $this->container = $container; - $this->serviceId = $serviceId; + $this->_serviceId = $serviceId; } protected function lazyLoadItself() { if (!isset($this->service)) { - $method_name = 'get' . Container::camelize($this->serviceId) . 'Service'; + $method_name = 'get' . Container::camelize($this->_serviceId) . 'Service'; $this->service = $this->container->$method_name(false); } diff --git a/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php b/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php index 25e329e..757e2a4 100644 --- a/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php +++ b/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php @@ -79,9 +79,11 @@ class {{ proxy_class }}{{ interface_string }} use \Drupal\Core\DependencyInjection\DependencySerializationTrait; /** + * Public for \Drupal\Core\DependencyInjection\DependencySerializationTrait. + * * @var string */ - protected $serviceId; + public $_serviceId; /** * @var \{{ class }} @@ -98,13 +100,13 @@ class {{ proxy_class }}{{ interface_string }} public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container, $serviceId) { $this->container = $container; - $this->serviceId = $serviceId; + $this->_serviceId = $serviceId; } protected function lazyLoadItself() { if (!isset($this->service)) { - $method_name = 'get' . Container::camelize($this->serviceId) . 'Service'; + $method_name = 'get' . Container::camelize($this->_serviceId) . 'Service'; $this->service = $this->container->$method_name(false); }