Exemplo n.º 1
0
 /**
  * Run a migration in a particular direction
  *
  * @param Migration $migration
  * @param string $direction
  * @return void
  */
 protected function run(Migration $migration, $direction = 'up')
 {
     $direction = $direction == 'down' ? 'down' : 'up';
     $this->getOutput()->writeln(sprintf(' == <info>' . $migration->getVersion() . ' ' . $migration->getName() . '</info> ' . '<comment>' . ($direction == 'up' ? 'migrating' : 'reverting') . '</comment>'));
     $start = microtime(1);
     $migration->setContainer($this->getContainer());
     $migration->init();
     $migration->{$direction}();
     $this->getAdapter()->{$direction}($migration);
     $end = microtime(1);
     $this->getOutput()->writeln(sprintf(' == <info>' . $migration->getVersion() . ' ' . $migration->getName() . '</info> ' . '<comment>' . ($direction == 'up' ? 'migrated ' : 'reverted ') . sprintf("%.4fs", $end - $start) . '</comment>'));
 }
Exemplo n.º 2
0
 public function setContainer(\ArrayAccess $container)
 {
     $this->_container = $container;
     return parent::setContainer($container);
 }
Exemplo n.º 3
0
 /**
  * @test
  */
 public function shouldRetrieveServices()
 {
     $this->migration->setContainer(new \ArrayObject(array('service' => 123)));
     $this->assertEquals(123, $this->migration->get('service'));
 }