private function singleImport($config, OutputInterface &$output, $entity_key = null)
{
$this->connection = $this->connectionFactory->createConnection($config['database']);
$this->connection->getConfiguration()->getSQLLogger(null);
if ($entity_key) {
if (!isset($config['maps'][$entity_key])) {
throw new \Exception("Entity alias not found: " . $entity_key);
}
$map = $config['maps'][$entity_key];
if (!$this->container->has($map['old_data']['service_id'])) {
throw new \Exception("Service not exists: " . $map['old_data']['service_id']);
}
$result = $this->importEntity($map);
$output->writeln("<info>Total " . count($result) . " {$entity_key} imported </info>");
} else {
foreach ((array) $config['maps'] as $key => $map) {
if (!$this->container->has($map['old_data']['service_id'])) {
throw new \Exception("Service not exists: " . $map['old_data']['service_id']);
}
$offset = 0;
do {
$result = $this->importEntity($map);
$output->writeln("<info>Total " . count($result) . " {$key} imported </info>");
if (!$result) {
break;
}
$offset++;
$this->setOffset($offset);
} while (true);
}
}
$this->connection->close();
}