cli-config.php 1001 Bytes
Newer Older
1
<?php
2

3
require_once __DIR__ . '/../../lib/Doctrine/Common/ClassLoader.php';
4

5
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
6
$classLoader->register();
7

8
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
9 10
$classLoader->register();

11 12
$config = new \Doctrine\ORM\Configuration();
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
13 14 15
$driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__."/Entities"));
$config->setMetadataDriverImpl($driverImpl);

16 17
$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Proxies');
18

19
$connectionOptions = array(
20 21
    'driver' => 'pdo_sqlite',
    'path' => 'database.sqlite'
22 23 24
);

$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);
25

26 27 28 29
$helperSet = new \Symfony\Components\Console\Helper\HelperSet(array(
    'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
    'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
));