diff --git a/src/Controller/PropagateNetworkSettingsAction.php b/src/Controller/PropagateNetworkSettingsAction.php index 0a41156..aa94df5 100644 --- a/src/Controller/PropagateNetworkSettingsAction.php +++ b/src/Controller/PropagateNetworkSettingsAction.php @@ -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()); diff --git a/src/Dto/Output/ClientOutput.php b/src/Dto/Output/ClientOutput.php index 0560e04..2391f60 100644 --- a/src/Dto/Output/ClientOutput.php +++ b/src/Dto/Output/ClientOutput.php @@ -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()