Переглянути джерело

[DoctrineBundle] added Registry::getConnections()

Fabien Potencier 14 роки тому
батько
коміт
85a381d048
1 змінених файлів з 15 додано та 0 видалено
  1. 15 0
      src/Symfony/Bundle/DoctrineBundle/Registry.php

+ 15 - 0
src/Symfony/Bundle/DoctrineBundle/Registry.php

@@ -68,6 +68,21 @@ class Registry
         return $this->container->get($this->connections[$name]);
     }
 
+    /**
+     * Gets an array of all registered connections
+     *
+     * @return array An array of Connection instances
+     */
+    public function getConnections()
+    {
+        $connections = array();
+        foreach ($this->connections as $name => $id) {
+            $connections[$name] = $this->container->get($id);
+        }
+
+        return $connections;
+    }
+
     /**
      * Gets all connection names.
      *