@@ 50-78 (lines=29) @@ | ||
47 | * |
|
48 | * @return callable |
|
49 | */ |
|
50 | private function getMongoDbsOptionsInitializerDefinition(Container $container): callable |
|
51 | { |
|
52 | return $container->protect(function () use ($container) { |
|
53 | static $initialized = false; |
|
54 | ||
55 | if ($initialized) { |
|
56 | return; |
|
57 | } |
|
58 | ||
59 | $initialized = true; |
|
60 | ||
61 | if (!isset($container['doctrine.mongo.dbs.options'])) { |
|
62 | $container['doctrine.mongo.dbs.options'] = [ |
|
63 | 'default' => isset($container['doctrine.mongo.db.options']) ? $container['doctrine.mongo.db.options'] : [], |
|
64 | ]; |
|
65 | } |
|
66 | ||
67 | $tmp = $container['doctrine.mongo.dbs.options']; |
|
68 | foreach ($tmp as $name => &$options) { |
|
69 | $options = array_replace_recursive($container['doctrine.mongo.db.default_options'], $options); |
|
70 | ||
71 | if (!isset($container['doctrine.mongo.dbs.default'])) { |
|
72 | $container['doctrine.mongo.dbs.default'] = $name; |
|
73 | } |
|
74 | } |
|
75 | ||
76 | $container['doctrine.mongo.dbs.options'] = $tmp; |
|
77 | }); |
|
78 | } |
|
79 | ||
80 | /** |
|
81 | * @param Container $container |
@@ 265-293 (lines=29) @@ | ||
262 | * |
|
263 | * @return callable |
|
264 | */ |
|
265 | private function getOrmEmsOptionsInitializerDefinition(Container $container): callable |
|
266 | { |
|
267 | return $container->protect(function () use ($container) { |
|
268 | static $initialized = false; |
|
269 | ||
270 | if ($initialized) { |
|
271 | return; |
|
272 | } |
|
273 | ||
274 | $initialized = true; |
|
275 | ||
276 | if (!isset($container['doctrine.orm.ems.options'])) { |
|
277 | $container['doctrine.orm.ems.options'] = [ |
|
278 | 'default' => isset($container['doctrine.orm.em.options']) ? |
|
279 | $container['doctrine.orm.em.options'] : [], |
|
280 | ]; |
|
281 | } |
|
282 | ||
283 | $tmp = $container['doctrine.orm.ems.options']; |
|
284 | foreach ($tmp as $name => &$options) { |
|
285 | $options = array_replace($container['doctrine.orm.em.default_options'], $options); |
|
286 | ||
287 | if (!isset($container['doctrine.orm.ems.default'])) { |
|
288 | $container['doctrine.orm.ems.default'] = $name; |
|
289 | } |
|
290 | } |
|
291 | ||
292 | $container['doctrine.orm.ems.options'] = $tmp; |
|
293 | }); |
|
294 | } |
|
295 | ||
296 | /** |