RegistryInterface.php 2.6 KB

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