ManagerRegistry.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Bridge\Doctrine;
  11. use Doctrine\Common\Persistence\AbstractManagerRegistry;
  12. use Symfony\Component\DependencyInjection\ContainerAwareInterface;
  13. use Symfony\Component\DependencyInjection\ContainerInterface;
  14. /**
  15. * References Doctrine connections and entity/document managers.
  16. *
  17. * @author Lukas Kahwe Smith <smith@pooteeweet.org>
  18. */
  19. abstract class ManagerRegistry extends AbstractManagerRegistry implements ContainerAwareInterface
  20. {
  21. /**
  22. * @var ContainerInterface
  23. */
  24. protected $container;
  25. /**
  26. * {@inheritdoc}
  27. */
  28. protected function getService($name)
  29. {
  30. return $this->container->get($name);
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. protected function resetService($name)
  36. {
  37. $this->container->set($name, null);
  38. }
  39. /**
  40. * {@inheritdoc}
  41. */
  42. public function setContainer(ContainerInterface $container = null)
  43. {
  44. $this->container = $container;
  45. }
  46. }