services_interfaces-2.php 2.1 KB

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