Fixed OU scope task
testing/ogcore-api/pipeline/head There was a failure building this commit Details
testing/ogcore-api/pipeline/pr-main There was a failure building this commit Details

pull/107/head
Manuel Aranda Rosales 2026-05-06 17:34:21 +02:00
parent 4a97bc8aff
commit 99e4c02411
1 changed files with 4 additions and 1 deletions

View File

@ -21,6 +21,7 @@ use App\Entity\Trace;
use App\Model\ClientStatus;
use App\Model\CommandTypes;
use App\Model\TraceStatus;
use App\Repository\ClientRepository;
use App\Repository\CommandTaskRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
@ -34,6 +35,7 @@ class RunScheduledCommandTasksCommand extends Command
{
public function __construct(
private readonly CommandTaskRepository $commandTaskRepository,
private readonly ClientRepository $clientRepository,
private readonly EntityManagerInterface $entityManager,
private readonly RunScriptAction $runScriptAction,
private readonly DeployImageAction $deployImageAction,
@ -101,7 +103,8 @@ class RunScheduledCommandTasksCommand extends Command
$scriptParameters = $script->getParameters();
if ($task->getScope() !== 'clients') {
$clients = $task->getOrganizationalUnit()?->getClients();
$ou = $task->getOrganizationalUnit();
$clients = $ou ? $this->clientRepository->findClientsByOrganizationalUnitAndDescendants($ou->getId()) : [];
} else {
$clients = $task->getClients();
}