/** * execute * * @param MigrateCommand $command * @param callable $next * * @return mixed */ public function execute($command, callable $next) { $migration = $command->getMigration(); if ($migration instanceof OptionsAwareInterface) { $migration->setOptions($command->getOptions()); } $next($command); }
/** * execute * * @param MigrateCommand $command * @param callable $next * * @return void */ public function execute($command, callable $next) { $migration = $command->getMigration(); if (!$migration instanceof TransactionAwareInterface) { $next($command); return; } $result = null; try { $migration->begin(); $next($command); $migration->finish(); } catch (\Exception $e) { $migration->abort($e); } }
/** * execute * * @param MigrateCommand $command * @param callable $next * * @return void */ public function execute($command, callable $next) { $migration = $command->getMigration(); $direction = $command->getOptions()->getDirection()->isUp() ? 'up' : 'down'; $migration->{$direction}(); }