doctrine.php 805 Bytes
Newer Older
1 2
<?php

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

romanb's avatar
romanb committed
5
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
6
$classLoader->register();
7

8
$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
9 10
$configuration = new \Doctrine\Common\Cli\Configuration();

11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
if (file_exists($configFile)) {
    if ( ! is_readable($configFile)) {
        trigger_error(
            'Configuration file [' . $configFile . '] does not have read permission.', E_ERROR
        );
    }

    require $configFile;
    
    foreach ($GLOBALS as $configCandidate) {
        if ($configCandidate instanceof \Doctrine\Common\Cli\Configuration) {
            $configuration = $configCandidate;
            break;
        }
    }
}

28
$cli = new \Doctrine\Common\Cli\CliController($configuration);
29
$cli->run($_SERVER['argv']);