Replaced group attribute with name attribute in Signal TDF element

This commit is contained in:
Nav
2024-09-15 15:27:08 +01:00
parent 179d7180a2
commit e522261991
266 changed files with 29437 additions and 29436 deletions

View File

@@ -770,6 +770,10 @@ class ValidationService
{
$failures = [];
if (empty($signal->name)) {
$failures[] = 'Missing name';
}
if (empty($signal->padKey)) {
$failures[] = 'Missing pad key';

View File

@@ -371,10 +371,10 @@ class FromXmlService
$attributes = $this->getNodeAttributesByName($element);
return new Signal(
$attributes['name'] ?? null,
$attributes['pad-key'] ?? null,
$this->stringService->tryStringToInt($attributes['index'] ?? null),
$attributes['function'] ?? null,
$attributes['group'] ?? null,
$attributes['field'] ?? null
);
}

View File

@@ -186,6 +186,7 @@ class ToXmlService
public function signalToXml(Signal $signal, DOMDocument $document): DOMElement
{
$element = $document->createElement('signal');
$element->setAttribute('name', $signal->name);
$element->setAttribute('pad-key', $signal->padKey);
if ($signal->index !== null) {
@@ -196,10 +197,6 @@ class ToXmlService
$element->setAttribute('function', $signal->function);
}
if ($signal->group !== null) {
$element->setAttribute('group', $signal->group);
}
if ($signal->field !== null) {
$element->setAttribute('field', $signal->field);
}

View File

@@ -3,23 +3,23 @@ namespace Targets\TargetDescriptionFiles;
class Signal
{
public ?string $name = null;
public ?string $padKey = null;
public ?int $index = null;
public ?string $function = null;
public ?string $group = null;
public ?string $field = null;
public function __construct(
?string $name,
?string $padKey,
?int $index,
?string $function,
?string $group,
?string $field
) {
$this->name = $name;
$this->padKey = $padKey;
$this->index = $index;
$this->function = $function;
$this->group = $group;
$this->field = $field;
}
}