44 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
require_once 'Doctrine/Common/ClassLoader.php';
 | 
						|
 | 
						|
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
 | 
						|
$classLoader->register();
 | 
						|
 | 
						|
$classLoader = new \Doctrine\Common\ClassLoader('Symfony');
 | 
						|
$classLoader->register();
 | 
						|
 | 
						|
$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
 | 
						|
 | 
						|
$helperSet = null;
 | 
						|
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 $helperSetCandidate) {
 | 
						|
        if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
 | 
						|
            $helperSet = $helperSetCandidate;
 | 
						|
            break;
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
$helperSet = ($helperSet) ?: new \Symfony\Component\Console\Helper\HelperSet();
 | 
						|
 | 
						|
$cli = new \Symfony\Component\Console\Application('Doctrine Command Line Interface', Doctrine\DBAL\Version::VERSION);
 | 
						|
$cli->setCatchExceptions(true);
 | 
						|
$cli->setHelperSet($helperSet);
 | 
						|
$cli->addCommands(array(
 | 
						|
    // DBAL Commands
 | 
						|
    new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(),
 | 
						|
    new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(),
 | 
						|
    new \Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand(),
 | 
						|
 | 
						|
));
 | 
						|
$cli->run();
 |