Newscoop\CommunityTickerBundle\Command\MigrateTablesCommand::execute PHP Method

execute() protected method

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        try {
            $em = $this->getApplication()->getKernel()->getContainer()->getService('em');
            $this->migrateData($em, $output);
            $connection = $em->getConnection();
            $connection->beginTransaction();
            try {
                $connection->query('SET FOREIGN_KEY_CHECKS=0');
                $connection->query('DROP TABLE community_ticker_event');
                $connection->query('SET FOREIGN_KEY_CHECKS=1');
                $connection->commit();
                $output->writeln('<info>Successfully removed. Finished!</info>');
            } catch (\Exception $e) {
                $connection->rollback();
                $output->writeln('<error>Using rollback. Failed!</error>');
            }
        } catch (\Exception $e) {
            throw new \Exception('Something went wrong!');
        }
    }