harden code and ingester
This commit is contained in:
@@ -6,7 +6,7 @@ namespace App\Command;
|
||||
|
||||
use App\Entity\DocumentVersion;
|
||||
use App\Entity\User;
|
||||
use App\Ingest\IngestFlow;
|
||||
use App\Service\IngestOrchestrator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
@@ -18,7 +18,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
class KnowledgeIngestCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
private readonly IngestFlow $ingestFlow,
|
||||
private readonly IngestOrchestrator $orchestrator,
|
||||
private readonly EntityManagerInterface $em,
|
||||
) {
|
||||
parent::__construct();
|
||||
@@ -33,8 +33,8 @@ class KnowledgeIngestCommand extends Command
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$versionId = $input->getArgument('versionId');
|
||||
$userId = $input->getArgument('userId');
|
||||
$versionId = (string) $input->getArgument('versionId');
|
||||
$userId = (string) $input->getArgument('userId');
|
||||
|
||||
$version = $this->em->getRepository(DocumentVersion::class)->find($versionId);
|
||||
$user = $this->em->getRepository(User::class)->find($userId);
|
||||
@@ -46,9 +46,9 @@ class KnowledgeIngestCommand extends Command
|
||||
|
||||
$output->writeln('Starting ingest...');
|
||||
|
||||
$this->ingestFlow->ingestDocumentVersion($version, $user);
|
||||
$job = $this->orchestrator->runForVersion($version, $user, false);
|
||||
|
||||
$output->writeln('<info>Ingest completed.</info>');
|
||||
$output->writeln(sprintf('<info>Ingest completed. Job: %s</info>', (string) $job->getId()));
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user