Improvements in trace
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
03e36f6218
commit
805fd70026
|
@ -2,7 +2,32 @@
|
|||
|
||||
namespace App\Service\Trace;
|
||||
|
||||
class CreateService
|
||||
{
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Command;
|
||||
use App\Entity\Trace;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
readonly class CreateService
|
||||
{
|
||||
public function __construct(
|
||||
private EntityManagerInterface $entityManager
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
public function __invoke(Client $client, Command $command, string $status, ?string $jobId = null, array $input): Trace
|
||||
{
|
||||
$trace = new Trace();
|
||||
$trace->setClient($client);
|
||||
$trace->setCommand($command ?? null);
|
||||
$trace->setStatus($status);
|
||||
$trace->setJobId($jobId);
|
||||
$trace->setExecutedAt(new \DateTime());
|
||||
$trace->setInput($input);
|
||||
|
||||
$this->entityManager->persist($trace);
|
||||
$this->entityManager->flush();
|
||||
|
||||
return $trace;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue