cli-config.php 1.6 KB
Newer Older
1
<?php
2 3 4 5 6
#
# This configuration file is loaded by the Doctrine CLI whenever you execute
# a task. A CLI configuration file usually initializes two local variables:
#
# $em - An EntityManager instance that the CLI tasks should use.
romanb's avatar
romanb committed
7 8 9
# $globalArguments - An array of default command line arguments that are passed to all
#                    CLI tasks automatically when an argument is not specifically set on
#                    the command line.
10 11 12 13 14 15 16 17 18 19 20 21
#
# You can create several CLI configuration files with different names, for different databases.
# Every CLI task recognizes the --config=<path> option where you can specify the configuration
# file to use for a particular task. If this option is not given, the CLI looks for a file
# named "cli-config.php" (this one) in the same directory and uses that by default.
#

require_once __DIR__ . '/../../lib/Doctrine/Common/IsolatedClassLoader.php';

$classLoader = new \Doctrine\Common\IsolatedClassLoader('Entities');
$classLoader->setBasePath(__DIR__);
$classLoader->register();
22

23 24 25 26
$classLoader = new \Doctrine\Common\IsolatedClassLoader('Proxies');
$classLoader->setBasePath(__DIR__);
$classLoader->register();

27 28
$config = new \Doctrine\ORM\Configuration();
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
29 30
$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Proxies');
31

32
$connectionOptions = array(
33 34
    'driver' => 'pdo_sqlite',
    'path' => 'database.sqlite'
35 36
);

37
// These are required named variables (names can't change!)
38
$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);
39 40

$globalArguments = array(
41
    'class-dir' => './Entities'
42
);