- <?php
- // Define path to application directory
- defined('APPLICATION_PATH')
- || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
- // Define application environment
- defined('APPLICATION_ENV')
- || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'default'));
- // Ensure library/ is on include_path
- set_include_path(implode(PATH_SEPARATOR, array(
- realpath(APPLICATION_PATH . '/../library'),
- get_include_path(),
- )));
- /** Zend_Application */
- require_once 'Zend/Application.php';
- require_once 'FMM/Application/ConfigLoader.php';
- $config = \FMM\Application\ConfigLoader::loadConfig();
- // Create application, bootstrap, and run
- $application = new Zend_Application(
- APPLICATION_ENV,
- $config
- );
- $bootstrap = $application->bootstrap()->getBootstrap();
- $bootstrap->bootstrap('Config')
- ->bootstrap('Doctrine');
- $autoloader = \Zend_Loader_Autoloader::getInstance();
- $classLoader = new \Doctrine\Common\ClassLoader('Symfony', APPLICATION_PATH . '/../library/vendor');
- $autoloader->pushAutoloader(array($classLoader, 'loadClass'), 'Symfony');
- $em = $application->getBootstrap()->getResource('doctrine');
- $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)
- ));
- $cli = new \Symfony\Components\Console\Application('Doctrine Command Line Interface', Doctrine\Common\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(),
- // ORM Commands
- new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(),
- new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(),
- new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(),
- new \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(),
- new \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(),
- new \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(),
- new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand(),
- new \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand(),
- new \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(),
- new \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(),
- new \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(),
- new \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand(),
- new \Doctrine\ORM\Tools\Console\Command\RunDqlCommand(),
- ));
- $cli->run();