protected function ProjectServiceContainer::getServiceWithMethodCallAndFactoryService in Service Container 7
Same name and namespace in other branches
- 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php \ProjectServiceContainer::getServiceWithMethodCallAndFactoryService()
 
Gets the 'service_with_method_call_and_factory' service.
This service is shared. This method always returns the same instance of the service.
Return value
\Bar\FooClass A Bar\FooClass instance.
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ Fixtures/ php/ services19.php, line 55  
Class
- ProjectServiceContainer
 - ProjectServiceContainer.
 
Code
protected function getServiceWithMethodCallAndFactoryService() {
  $this->services['service_with_method_call_and_factory'] = $instance = new \Bar\FooClass();
  $instance
    ->setBar(\Bar\FooClass::getInstance());
  return $instance;
}