You are here

protected function ProjectServiceContainer::getInlinedService in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php \ProjectServiceContainer::getInlinedService()

Gets the 'inlined' service.

This service is shared. This method always returns the same instance of the service.

This service is private. If you want to be able to request this service from the container directly, make it public, otherwise you might end up with broken code.

Return value

\Bar A Bar instance.

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php, line 332

Class

ProjectServiceContainer
ProjectServiceContainer.

Code

protected function getInlinedService() {
  $this->services['inlined'] = $instance = new \Bar();
  $instance
    ->setBaz($this
    ->get('baz'));
  $instance->pub = 'pub';
  return $instance;
}