Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand;
- use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand;
- use Doctrine\Bundle\MigrationsBundle\Command\MigrationsMigrateDoctrineCommand;
- use Symfony\Bundle\FrameworkBundle\Console\Application;
- use Symfony\Component\Console\Input\ArrayInput;
- use Symfony\Component\Console\Output\ConsoleOutput;
- require_once 'autoload.php';
- $kernel = new AppKernel('test', true); // create a "test" kernel
- $kernel->boot();
- $application = new Application($kernel);
- $command = new DropDatabaseDoctrineCommand();
- $application->add($command);
- $input = new ArrayInput(array(
- 'command' => 'doctrine:database:drop',
- '--force' => true,
- ));
- $command->run($input, new ConsoleOutput());
- // add the database:create command to the application and run it
- $command = new CreateDatabaseDoctrineCommand();
- $application->add($command);
- $input = new ArrayInput(array(
- 'command' => 'doctrine:database:create',
- ));
- $command->run($input, new ConsoleOutput());
- // Add the doctrine:migrations:migrate command to the application and run it
- $command = new MigrationsMigrateDoctrineCommand();
- $application->add($command);
- $input = new ArrayInput(array(
- 'command' => 'doctrine:migrations:migrate',
- '--no-interaction' => true,
- ));
- $command->run($input, new ConsoleOutput());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement