forked from jeroenweustink/slim-rest-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli-config.php
27 lines (21 loc) · 950 Bytes
/
cli-config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
require_once __DIR__ . '/class-loader.php';
$config = new \Doctrine\ORM\Configuration();
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
$driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__ . '/src/App/Entity'));
$config->setMetadataDriverImpl($driverImpl);
$config->setProxyDir(__DIR__ . '/src/App/Entity/Proxy');
$config->setProxyNamespace('Proxy');
$ini = parse_ini_file(__DIR__ . '/config/local.ini');
$connectionOptions = array(
'driver' => $ini['driv'],
'host' => $ini['host'],
'dbname' => $ini['name'],
'user' => $ini['user'],
'password' => $ini['pass'],
);
$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);
$helpers = new Symfony\Component\Console\Helper\HelperSet(array(
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
));