Added loaded trace command
testing/ogcore-api/pipeline/head There was a failure building this commit
Details
testing/ogcore-api/pipeline/head There was a failure building this commit
Details
parent
de165935e0
commit
b98d6d2be8
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace App\Command;
|
||||
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Trace;
|
||||
use App\Model\CommandTypes;
|
||||
use App\Model\TraceStatus;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
#[AsCommand(name: 'opengnsys:load-traces', description: 'Load traces')]
|
||||
class ChargeExampleTraceCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$clients = $this->entityManager->getRepository(Client::class)->findAll();
|
||||
$traces = TraceStatus::getStatusKeys();
|
||||
|
||||
var_dump($traces);
|
||||
|
||||
|
||||
foreach ($clients as $client) {
|
||||
foreach ($traces as $traceStatus) {
|
||||
$trace = new Trace();
|
||||
$trace->setClient($client);
|
||||
$trace->setJobId('CreateAuxiliarFiles_' . $client->getId());
|
||||
$trace->setStatus($traceStatus);
|
||||
$trace->setCommand(CommandTypes::CREATE_IMAGE_AUX_FILE);
|
||||
$trace->setExecutedAt(new \DateTime());
|
||||
$this->entityManager->persist($trace);
|
||||
}
|
||||
}
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue