Guest User

Untitled

a guest
Oct 18th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1. <?php
  2.  
  3. // Define path to application directory
  4. defined('APPLICATION_PATH')
  5. || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
  6.  
  7. // Define application environment, (I am only running this in development)
  8. define('APPLICATION_ENV', 'development');
  9.  
  10. // Ensure library/ is on include_path
  11. set_include_path(implode(PATH_SEPARATOR, array(
  12. realpath(APPLICATION_PATH . '/../library'),
  13. get_include_path(),
  14. )));
  15.  
  16. /** Zend_Application */
  17. require_once 'Zend/Application.php';
  18.  
  19. // Creating application
  20. $application = new Zend_Application(
  21. APPLICATION_ENV,
  22. APPLICATION_PATH . '/configs/application.ini'
  23. );
  24.  
  25. // Bootstrapping resources
  26. $bootstrap = $application->bootstrap()->getBootstrap();
  27. $bootstrap->bootstrap('Doctrine');
  28.  
  29. // Retrieve Doctrine Container resource
  30. $container = $application->getBootstrap()->getResource('doctrine');
  31.  
  32. // Console
  33. $cli = new \Symfony\Component\Console\Application(
  34. 'Doctrine Command Line Interface',
  35. \Doctrine\Common\Version::VERSION
  36. );
  37.  
  38. try {
  39. // Bootstrapping Console HelperSet
  40. $helperSet = array();
  41.  
  42. if (($dbal = $container->getConnection(getenv('CONN') ?: $container->defaultConnection)) !== null) {
  43. $helperSet['db'] = new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($dbal);
  44. }
  45.  
  46. if (($em = $container->getEntityManager(getenv('EM') ?: $container->defaultEntityManager)) !== null) {
  47. $helperSet['em'] = new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em);
  48. }
  49. } catch (\Exception $e) {
  50. $cli->renderException($e, new \Symfony\Component\Console\Output\ConsoleOutput());
  51. }
  52.  
  53. $cli->setCatchExceptions(true);
  54. $cli->setHelperSet(new \Symfony\Component\Console\Helper\HelperSet($helperSet));
  55.  
  56. $cli->addCommands(array(
  57. // DBAL Commands
  58. new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(),
  59. new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(),
  60.  
  61. // ORM Commands
  62. new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(),
  63. new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(),
  64. new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(),
  65. new \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(),
  66. new \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(),
  67. new \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(),
  68. new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand(),
  69. new \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand(),
  70. new \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(),
  71. new \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(),
  72. new \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(),
  73. new \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand(),
  74. new \Doctrine\ORM\Tools\Console\Command\RunDqlCommand(),
  75.  
  76. ));
  77.  
  78. $cli->run();
Add Comment
Please, Sign In to add comment