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.
35 lines
1021 B
PHP
35 lines
1021 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 = [];
|
|
|
|
$entityPaths = [];
|
|
$connectionInfos = [];
|
|
|
|
foreach ($connections as $name => $connection) {
|
|
$connectionNames[] = $name;
|
|
|
|
$entityPaths['doctrine.entity-paths.' . $name] = $connection['entity-paths'] instanceof EntryReference ? $connection['entity-paths'] : add($connection['entity-paths'] ?? []);
|
|
$entityPaths['doctrine.connection.' . $name] = $connection['connection'] instanceof EntryReference ? $connection['connection'] : add($connection['connection'] ?? []);
|
|
}
|
|
|
|
|
|
return array_merge(
|
|
[
|
|
'doctrine.connections' => add($connectionNames),
|
|
],
|
|
$entityPaths,
|
|
$connectionInfos
|
|
);
|
|
}
|
|
} |