ref 2994. Propagacion con Hardware profile.
testing/ogcore-api/pipeline/head There was a failure building this commit Details
ogcore-debian-package/pipeline/head This commit looks good Details

pull/125/head
Manuel Aranda Rosales 2026-07-07 17:30:15 +02:00
parent 1bf33e73d1
commit 8307844596
2 changed files with 16 additions and 1 deletions

View File

@ -43,7 +43,11 @@ class PropagateNetworkSettingsAction extends AbstractController
foreach ($organizationalUnit->getClients() as $client) {
$client->setMenu($networkSettings->getMenu());
$client->setHardwareProfile($networkSettings->getHardwareProfile());
// No se propaga hardwareProfile: Client::$hardwareProfile es un registro 1:1
// propio de cada cliente (hardware_profile.client_id es NOT NULL), no una
// plantilla compartible como menu/repository/bootServer/ogLive/template.
// Esta llamada además tocaba el lado inverso de la relación de Doctrine y
// nunca llegaba a persistirse.
$client->setRepository($networkSettings->getRepository());
$client->setBootServer($networkSettings->getBootServer());
$client->setOgLive($networkSettings->getOgLive());

View File

@ -8,6 +8,7 @@ use App\Entity\Client;
use App\Entity\Partition;
use Symfony\Component\Serializer\Annotation\Groups;
use App\Dto\Output\BootServerOutput;
use App\Dto\Output\HardwareProfileOutput;
#[Get(shortName: 'Client')]
final class ClientOutput extends AbstractOutput
@ -91,6 +92,13 @@ final class ClientOutput extends AbstractOutput
)]
public ?MenuOutput $menu = null;
#[Groups(['client:read'])]
#[ApiProperty(
description: 'El perfil de hardware propio del cliente (registro 1:1, gestionado desde /hardware-profiles)',
example: null
)]
public ?HardwareProfileOutput $hardwareProfile = null;
#[Groups(['client:read'])]
#[ApiProperty(
description: 'El repositorio de imágenes asignado al cliente',
@ -210,6 +218,9 @@ final class ClientOutput extends AbstractOutput
)->toArray();
$this->menu = $client->getMenu() ? new MenuOutput($client->getMenu()) : null;
$this->hardwareProfile = $client->getHardwareProfile()
? new HardwareProfileOutput($client->getHardwareProfile(), includeClient: false)
: null;
$this->position = $client->getPosition();
$repository = $client->getRepository()