You are here

protected function ProjectServiceContainer::getNewFactoryService in Service Container 7.2

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

Gets the 'new_factory' 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

\FactoryClass A FactoryClass instance.

File

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

Class

ProjectServiceContainer
ProjectServiceContainer.

Code

protected function getNewFactoryService() {
  $this->services['new_factory'] = $instance = new \FactoryClass();
  $instance->foo = 'bar';
  return $instance;
}