You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
879 B
PHP
36 lines
879 B
PHP
<?php
|
|
|
|
namespace BitCommunism\Doctrine;
|
|
|
|
use function DI\add;
|
|
use DI\Definition\EntryReference;
|
|
|
|
if (!function_exists(__NAMESPACE__ . '\\connections')) {
|
|
/**
|
|
* @param $connections
|
|
* @return array
|
|
*/
|
|
function connections($connections) {
|
|
$connectionNames = [];
|
|
|
|
$containerDef = [];
|
|
|
|
foreach ($connections as $name => $connection) {
|
|
$connectionNames[] = $name;
|
|
|
|
$entityPathsObject = $connection['entity-paths'];
|
|
$connectionObject = $connection['connection'];
|
|
|
|
$containerDef['doctrine.entity-paths.' . $name] = $entityPathsObject;
|
|
$containerDef['doctrine.connection.' . $name] = $connectionObject;
|
|
}
|
|
|
|
|
|
return array_merge(
|
|
[
|
|
'doctrine.connections' => add($connectionNames),
|
|
],
|
|
$containerDef
|
|
);
|
|
}
|
|
} |