| @@ 69-82 (lines=14) @@ | ||
| 66 | * @return Connection |
|
| 67 | * @throws \InvalidArgumentException |
|
| 68 | */ |
|
| 69 | public function getConnection($name = null) |
|
| 70 | { |
|
| 71 | $this->loadConnections(); |
|
| 72 | ||
| 73 | if ($name === null) { |
|
| 74 | $name = $this->getDefaultConnectionName(); |
|
| 75 | } |
|
| 76 | ||
| 77 | if (!isset($this->connections[$name])) { |
|
| 78 | throw new \InvalidArgumentException(sprintf('Doctrine Connection named "%s" does not exist.', $name)); |
|
| 79 | } |
|
| 80 | ||
| 81 | return $this->connections[$name]; |
|
| 82 | } |
|
| 83 | ||
| 84 | /** |
|
| 85 | * @return array |
|
| @@ 139-152 (lines=14) @@ | ||
| 136 | * @return ObjectManager |
|
| 137 | * @throws \InvalidArgumentException |
|
| 138 | */ |
|
| 139 | public function getManager($name = null) |
|
| 140 | { |
|
| 141 | $this->loadManagers(); |
|
| 142 | ||
| 143 | if ($name === null) { |
|
| 144 | $name = $this->getDefaultManagerName(); |
|
| 145 | } |
|
| 146 | ||
| 147 | if (!isset($this->managers[$name])) { |
|
| 148 | throw new \InvalidArgumentException(sprintf('Doctrine Manager named "%s" does not exist.', $name)); |
|
| 149 | } |
|
| 150 | ||
| 151 | return $this->managers[$name]; |
|
| 152 | } |
|
| 153 | ||
| 154 | /** |
|
| 155 | * @return array |
|
| @@ 191-204 (lines=14) @@ | ||
| 188 | * @return void |
|
| 189 | * @throws \InvalidArgumentException |
|
| 190 | */ |
|
| 191 | public function resetManager($name = null) |
|
| 192 | { |
|
| 193 | $this->loadManagers(); |
|
| 194 | ||
| 195 | if (null === $name) { |
|
| 196 | $name = $this->getDefaultManagerName(); |
|
| 197 | } |
|
| 198 | ||
| 199 | if (!isset($this->managers[$name])) { |
|
| 200 | throw new \InvalidArgumentException(sprintf('Doctrine Manager named "%s" does not exist.', $name)); |
|
| 201 | } |
|
| 202 | ||
| 203 | $this->managers[$name] = null; |
|
| 204 | } |
|
| 205 | ||
| 206 | protected function loadManagers() |
|
| 207 | { |
|