Advertisement
Guest User

Untitled

a guest
May 29th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <?php
  2.  
  3. use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand;
  4. use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand;
  5. use Doctrine\Bundle\MigrationsBundle\Command\MigrationsMigrateDoctrineCommand;
  6. use Symfony\Bundle\FrameworkBundle\Console\Application;
  7. use Symfony\Component\Console\Input\ArrayInput;
  8. use Symfony\Component\Console\Output\ConsoleOutput;
  9.  
  10. require_once 'autoload.php';
  11.  
  12. $kernel = new AppKernel('test', true); // create a "test" kernel
  13. $kernel->boot();
  14.  
  15. $application = new Application($kernel);
  16.  
  17. $command = new DropDatabaseDoctrineCommand();
  18. $application->add($command);
  19. $input = new ArrayInput(array(
  20. 'command' => 'doctrine:database:drop',
  21. '--force' => true,
  22. ));
  23. $command->run($input, new ConsoleOutput());
  24.  
  25. // add the database:create command to the application and run it
  26. $command = new CreateDatabaseDoctrineCommand();
  27. $application->add($command);
  28. $input = new ArrayInput(array(
  29. 'command' => 'doctrine:database:create',
  30. ));
  31. $command->run($input, new ConsoleOutput());
  32.  
  33. // Add the doctrine:migrations:migrate command to the application and run it
  34. $command = new MigrationsMigrateDoctrineCommand();
  35. $application->add($command);
  36. $input = new ArrayInput(array(
  37. 'command' => 'doctrine:migrations:migrate',
  38. '--no-interaction' => true,
  39. ));
  40. $command->run($input, new ConsoleOutput());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement