-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli-config.php
30 lines (22 loc) · 922 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
28
29
30
<?php
$namespaces = require_once(dirname(__FILE__) . '/config/namespaces.php');
require_once(dirname(__FILE__) . '/config/config_parser.php');
$configParser = new ConfigParser();
use Doctrine\ORM\Mapping\Driver\YamlDriver;
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
$dbParams = array(
'driver' => db_driver,
'user' => db_user,
'password' => db_pass,
'dbname' => db_name,
'charset' => db_charset,
);
$config = Setup::createAnnotationMetadataConfiguration(array(yaml_path), false);
$em = EntityManager::create($dbParams, $config);
$driver = new YamlDriver(array(yaml_path));
$config->setMetadataDriverImpl($driver);
$helperSet = 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)
));