Version20180117141124.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace Application\Migrations;
  3. use Doctrine\DBAL\Migrations\AbstractMigration;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Symfony\Component\DependencyInjection\ContainerAwareInterface;
  6. use Symfony\Component\DependencyInjection\ContainerInterface;
  7. use Symfony\Component\Process\Process;
  8. /**
  9. * Migración que corre el comando init:templates:docsis para cargar los modelos y template docsis
  10. */
  11. class Version20180117141124 extends AbstractMigration implements ContainerAwareInterface
  12. {
  13. /**
  14. * @var ContainerInterface
  15. */
  16. private $container;
  17. /**
  18. * @param ContainerInterface $container
  19. */
  20. public function setContainer(ContainerInterface $container = null)
  21. {
  22. $this->container = $container;
  23. }
  24. /**
  25. * @param Schema $schema
  26. */
  27. public function up(Schema $schema)
  28. {
  29. $consolePath = $this->container->get('kernel')->getRootDir() . '/../bin/console';
  30. $process = new Process("{$consolePath} init:templates:docsis");
  31. $process->run();
  32. $content = $process->getOutput();
  33. echo $content;
  34. }
  35. public function down(Schema $schema)
  36. {
  37. }
  38. }