protected function printExceptions($output, $import)
{
/** @var $logger LoggerInterface */
$logger = $this->getContainer()->get('logger');
if (null === $output) {
$output = new NullOutput();
}
$output->writeln(['', '', '<info>Import Result</info>', '<info>===============</info>', '<info>' . $import->successes . ' Documents imported.</info>', '<comment>' . count($import->failed) . ' Documents ignored.</comment>']);
if (!isset($import->exceptionStore['ignore'])) {
return;
}
// If more than 20 exceptions write only into log.
if (count($import->exceptionStore['ignore']) > 20) {
foreach ($import->exceptionStore['ignore'] as $msg) {
$logger->info($msg);
}
return;
}
foreach ($import->exceptionStore['ignore'] as $msg) {
$output->writeln('<comment>' . $msg . '</comment>');
$logger->info($msg);
}
}