Knp\Bundle\KnpBundlesBundle\Command\KbUpdateTrendsCommand::execute PHP Метод

execute() защищенный Метод

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)
    {
        $em = $this->getContainer()->get('knp_bundles.entity_manager');
        if ($em->getConnection()->getDatabasePlatform()->getName() == 'sqlite') {
            $output->writeln(sprintf('[%s] This command can\'t be executed on <error>SQLite</error>!', date('d-m-y H:i:s')));
            return 1;
        }
        $em->getConnection()->beginTransaction();
        try {
            $nbRows = $this->updateTrends();
            $output->writeln(sprintf('[%s] <info>%s</info> rows updated', date('d-m-y H:i:s'), $nbRows));
            $em->getConnection()->commit();
        } catch (\Exception $e) {
            $output->writeln(sprintf('[%s] <error>Rollbacking</error> because of %s', date('d-m-y H:i:s'), $e));
            $em->getConnection()->rollback();
            $em->close();
            return 1;
        }
        return 0;
    }