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.
doctrine/config/default.php

54 lines
1.3 KiB
PHTML

7 years ago
<?php
namespace BitCommunism\Doctrine;
use DI\Container;
use Doctrine\ORM\Tools\Console\ConsoleRunner;
use function DI\add;
7 years ago
use function DI\factory;
use function DI\get;
use function DI\string;
return [
'marx.calls' => add([
'doctrine' => function (EntityManagerLike $em, $arguments) {
$connection = $em->getEntityManager($arguments[0] ?? 'default');
return ConsoleRunner::createHelperSet($connection);
7 years ago
},
]),
'doctrine.debug' => get('debug'),
'doctrine.single-connection' => false,
'doctrine.connections' => add([
'default',
]),
'doctrine.connection.default' => get('doctrine.connection'),
'doctrine.entity-paths.default' => get('doctrine.entity-paths'),
7 years ago
'doctrine.entity-paths' => add([
string('{basedir}/src/Entity')
]),
'doctrine.connection' => add([
'driver' => 'pdo_mysql',
7 years ago
'hostname' => 'localhost',
'password' => '',
'user' => 'root',
]),
'em' => get(EntityManagerLike::class),
7 years ago
EntityManagerLike::class => factory(function (Container $c) {
$contextAware = $c->get(ContextAwareEntityManager::class);
7 years ago
if ($c->get('doctrine.single-connection')) {
return $contextAware->getEntityManager('default');
}
7 years ago
return $contextAware;
7 years ago
}),
];