protected function execute(InputInterface $input, OutputInterface $output)
{
$this->io->title($this->getDescription());
$totalAuthorCount = $this->getAuthorCount();
$this->io->progressStart($totalAuthorCount);
$rsm = new ResultSetMapping();
for ($count = 0; $count <= $totalAuthorCount; $count += self::STEP) {
$sql = <<<SQL
UPDATE author
SET user_id = users.id
FROM users
WHERE author.email = users.email
AND author.id > ?
and author.id < ?
and author.user_id is null
SQL;
$query = $this->em->createNativeQuery($sql, $rsm);
$query->setParameter(1, $count);
$query->setParameter(2, $count + self::STEP);
$query->getResult();
if (self::STEP > $totalAuthorCount) {
$this->io->progressFinish();
} else {
$this->io->progressAdvance(self::STEP);
}
}
$this->io->newLine(2);
$this->io->success('All process finished');
}