RegistryInterface.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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\ManagerRegistry as ManagerRegistryInterface;
  12. use Doctrine\ORM\EntityManager;
  13. /**
  14. * References Doctrine connections and entity managers.
  15. *
  16. * @author Fabien Potencier <fabien@symfony.com>
  17. */
  18. interface RegistryInterface extends ManagerRegistryInterface
  19. {
  20. /**
  21. * Gets the default entity manager name.
  22. *
  23. * @return string The default entity manager name
  24. */
  25. public function getDefaultEntityManagerName();
  26. /**
  27. * Gets a named entity manager.
  28. *
  29. * @param string $name The entity manager name (null for the default one)
  30. *
  31. * @return EntityManager
  32. */
  33. public function getEntityManager($name = null);
  34. /**
  35. * Gets an array of all registered entity managers.
  36. *
  37. * @return array An array of EntityManager instances
  38. */
  39. public function getEntityManagers();
  40. /**
  41. * Resets a named entity manager.
  42. *
  43. * This method is useful when an entity manager has been closed
  44. * because of a rollbacked transaction AND when you think that
  45. * it makes sense to get a new one to replace the closed one.
  46. *
  47. * Be warned that you will get a brand new entity manager as
  48. * the existing one is not useable anymore. This means that any
  49. * other object with a dependency on this entity manager will
  50. * hold an obsolete reference. You can inject the registry instead
  51. * to avoid this problem.
  52. *
  53. * @param string $name The entity manager name (null for the default one)
  54. *
  55. * @return EntityManager
  56. */
  57. public function resetEntityManager($name = null);
  58. /**
  59. * Resolves a registered namespace alias to the full namespace.
  60. *
  61. * This method looks for the alias in all registered entity managers.
  62. *
  63. * @param string $alias The alias
  64. *
  65. * @return string The full namespace
  66. *
  67. * @see Configuration::getEntityNamespace
  68. */
  69. public function getEntityNamespace($alias);
  70. /**
  71. * Gets all connection names.
  72. *
  73. * @return array An array of connection names
  74. */
  75. public function getEntityManagerNames();
  76. /**
  77. * Gets the entity manager associated with a given class.
  78. *
  79. * @param string $class A Doctrine Entity class name
  80. *
  81. * @return EntityManager|null
  82. */
  83. public function getEntityManagerForClass($class);
  84. }