services_interfaces-2.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. use Symfony\Component\DependencyInjection\ContainerInterface;
  3. use Symfony\Component\DependencyInjection\Container;
  4. use Symfony\Component\DependencyInjection\Reference;
  5. use Symfony\Component\DependencyInjection\Parameter;
  6. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
  7. /**
  8. * ProjectServiceContainer
  9. *
  10. * This class has been auto-generated
  11. * by the Symfony Dependency Injection Component.
  12. */
  13. class ProjectServiceContainer extends Container
  14. {
  15. /**
  16. * Constructor.
  17. */
  18. public function __construct()
  19. {
  20. parent::__construct(new ParameterBag($this->getDefaultParameters()));
  21. }
  22. /**
  23. * Gets the 'bar' service.
  24. *
  25. * This service is shared.
  26. * This method always returns the same instance of the service.
  27. *
  28. * @return Object An instance returned by barFactory::createBarClass().
  29. */
  30. protected function getBarService()
  31. {
  32. return $this->services['bar'] = $this->get('barFactory')->createBarClass();
  33. }
  34. /**
  35. * Gets the 'barfactory' service.
  36. *
  37. * This service is shared.
  38. * This method always returns the same instance of the service.
  39. *
  40. * @return BarClassFactory A BarClassFactory instance.
  41. */
  42. protected function getBarfactoryService()
  43. {
  44. return $this->services['barfactory'] = new \BarClassFactory();
  45. }
  46. /**
  47. * Applies all known interface injection calls
  48. *
  49. * @param Object $instance
  50. */
  51. protected function applyInterfaceInjectors($instance)
  52. {
  53. if ($instance instanceof \BarClass) {
  54. $instance->setFoo('someValue');
  55. }
  56. }
  57. }