ltbxdGateway->parseFile(); } catch (GatewayException $e) { $output->writeln('/!\ '.$e->getMessage()); return Command::FAILURE; } $i = 0; foreach ($ltbxdMovies as $ltbxdMovie) { try { $movie = $this->filmImporter->importFromLtbxdMovie($ltbxdMovie); if ($movie) { $output->writeln('* Found '.$ltbxdMovie->getName()); } } catch (GatewayException $e) { $output->writeln('/!\ '.$e->getMessage()); return Command::FAILURE; } ++$i; if (0 === $i % 50) { $this->em->flush(); } } $this->em->flush(); $output->writeln('Films synced'); return Command::SUCCESS; } }