Skip to content

Instantly share code, notes, and snippets.

@pierrejoye
Last active August 29, 2015 14:22
Show Gist options
  • Save pierrejoye/93197fb9a68061713911 to your computer and use it in GitHub Desktop.
Save pierrejoye/93197fb9a68061713911 to your computer and use it in GitHub Desktop.
$app->container->singleton(
'doctrine.entitymanager',
function (Set $container) {
$paths = [__DIR__."/../src/Doctrine/Mapping/"];
$isDev = true;
$dbConfig = $container->get('app.config')['doctrine'];
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDev, null, null, FALSE);
$entityManager = Doctrine\ORM\EntityManager::create($dbConfig, $config);
return $entityManager;
}
);
...
if (0) {
$entities = array();
$meta = $em->getMetadataFactory()->getAllMetadata();
foreach ($meta as $m) {
$entities[] = $m->getName();
}
}
$leagueRepository = $em->getRepository('Pool\Entity\League');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment