Created
August 17, 2015 06:54
-
-
Save harikt/1602f0d9e3c89659198a to your computer and use it in GitHub Desktop.
Configuring Doctrine ORM Entity Manager with Aura.Di
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$di->set('entity_manager', function () { | |
// paths | |
$paths = array(__DIR__); | |
$isDevMode = false; | |
// the connection configuration | |
$dbParams = array( | |
'driver' => 'pdo_mysql', | |
'user' => getenv('username'), | |
'password' => getenv('password'), | |
'dbname' => getenv('dbname'), | |
); | |
$config = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration($paths, $isDevMode); | |
$entityManager = \Doctrine\ORM\EntityManager::create($dbParams, $config); | |
return $entityManager; | |
}); | |
// $entity_manager = $di->get('entity_manager'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
iirc what I tried to do was something like
but this is very complicated and may be I ended up at the above gist itself if I am correct. There are a lot of experimental projects that I was unable to find :( . In case I came across will update.