예제 #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->initDoctrine($input, $output);
     if ($this->transactional) {
         $this->em->getConnection()->beginTransaction();
     }
     try {
         $ret = parent::execute($input, $output);
         if ($ret <= 0) {
             if ($this->echoLog) {
                 DoctrineHelper::enableSQLLogging('echo', $this->em);
             }
             if ($input->getOption('dry-run')) {
                 $this->warn('DryRun: nothing is flushed');
             } else {
                 $this->em->flush();
             }
             if ($this->transactional) {
                 $this->em->getConnection()->commit();
             }
         } else {
             if ($this->transactional) {
                 $this->em->getConnection()->rollback();
             }
         }
     } catch (\Exception $e) {
         if ($this->transactional) {
             $this->em->getConnection()->rollback();
         }
         $this->em->close();
         throw $e;
     }
     return $ret;
 }
예제 #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->execInput = $input;
     $output->writeln('Start Compiling file: ' . $this->getInFile());
     parent::execute($input, $output);
     $output->writeln('finished.');
 }
예제 #3
0
 public function configure()
 {
     parent::configure();
     $configure = $this->configure;
     $definition = $configure($this);
     if (is_array($definition)) {
         $this->setDefinition($definition);
     }
 }