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.
44 lines
1.0 KiB
PHTML
44 lines
1.0 KiB
PHTML
7 years ago
|
<?php
|
||
|
|
||
|
namespace BitCommunism\Doctrine;
|
||
|
|
||
|
use function DI\add;
|
||
|
use DI\Container;
|
||
|
use function DI\factory;
|
||
|
use function DI\get;
|
||
|
use function DI\string;
|
||
|
use Doctrine\ORM\EntityManager;
|
||
|
use Doctrine\ORM\Tools\Console\ConsoleRunner;
|
||
|
use Doctrine\ORM\Tools\Setup;
|
||
|
|
||
|
return [
|
||
|
|
||
|
'marx.calls' => [
|
||
|
'doctrine' => function(EntityManager $em) {
|
||
|
return ConsoleRunner::createHelperSet($em);
|
||
|
},
|
||
|
],
|
||
|
|
||
|
'doctrine.debug' => false,
|
||
|
'doctrine.entity-paths' => add([
|
||
|
string('{basedir}/src/Entity')
|
||
|
]),
|
||
|
'doctrine.database' => [
|
||
|
'driver' => 'pdo_mysql',
|
||
|
'hostname' => 'localhost',
|
||
|
'user' => 'root',
|
||
|
'password' => '',
|
||
|
'dbname' => '',
|
||
|
],
|
||
|
|
||
|
'em' => get(EntityManager::class),
|
||
|
|
||
|
EntityManager::class => factory(function (Container $c) {
|
||
|
$setup = Setup::createAnnotationMetadataConfiguration(
|
||
|
$c->get('doctrine.entity-paths'),
|
||
|
$c->get('doctrine.debug')
|
||
|
);
|
||
|
|
||
|
return EntityManager::create($c->get('doctrine.database'), $setup);
|
||
|
}),
|
||
|
];
|