Advertisement
Guest User

application/doctrine.php

a guest
Oct 5th, 2010
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.27 KB | None | 0 0
  1. <?php
  2. chdir(dirname(__FILE__) . '/libraries');
  3.  
  4. require_once 'Doctrine/Common/ClassLoader.php';
  5.  
  6. $classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
  7. $classLoader->register();
  8.  
  9. $classLoader = new \Doctrine\Common\ClassLoader('Symfony', 'Doctrine');
  10. $classLoader->register();
  11.  
  12. $configFile = '../cli-config.php';
  13. $helperSet = null;
  14. if (file_exists($configFile)) {
  15.     if ( ! is_readable($configFile)) {
  16.         trigger_error(
  17.             'Configuration file [' . $configFile . '] does not have read permission.', E_ERROR
  18.         );
  19.     }
  20.  
  21.     require $configFile;
  22.  
  23.     foreach ($GLOBALS as $helperSetCandidate) {
  24.         if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
  25.             $helperSet = $helperSetCandidate;
  26.             break;
  27.         }
  28.     }
  29. }
  30.  
  31. $helperSet = ($helperSet) ?: new \Symfony\Component\Console\Helper\HelperSet();
  32.  
  33. $cli = new \Symfony\Component\Console\Application('Doctrine Command Line Interface', Doctrine\ORM\Version::VERSION);
  34. $cli->setCatchExceptions(true);
  35. $cli->setHelperSet($helperSet);
  36. $cli->addCommands(array(
  37.     // DBAL Commands
  38.     new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(),
  39.     new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(),
  40.  
  41.     // ORM Commands
  42.     new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(),
  43.     new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(),
  44.     new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(),
  45.     new \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(),
  46.     new \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(),
  47.     new \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(),
  48.     new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand(),
  49.     new \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand(),
  50.     new \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(),
  51.     new \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(),
  52.     new \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(),
  53.     new \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand(),
  54.     new \Doctrine\ORM\Tools\Console\Command\RunDqlCommand(),
  55.     new \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand(),
  56.  
  57. ));
  58. $cli->run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement