Skip to content

Commit 52ab655

Browse files
committed
Fix parsing of records into desired DTO
1 parent 27da4d8 commit 52ab655

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Models/Zones/RRSet.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ public function setAdditionalData($data)
6464
$this->name = $data->name;
6565
$this->type = $data->type;
6666
$this->ttl = $data->ttl;
67-
$this->records = $data->records;
67+
$records = [];
68+
foreach ($data->records as $record) {
69+
$records[] = Record::parse($record);
70+
}
71+
72+
$this->records = $records;
6873
$this->labels = get_object_vars($data->labels);
6974
$this->protection = RRSetProtection::parse($data->protection);
7075
$this->zone = $data->zone;

src/Models/Zones/Record.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,9 @@ public function __construct(string $value, string $comment)
1212
$this->value = $value;
1313
$this->comment = $comment;
1414
}
15+
16+
public static function parse($input): self
17+
{
18+
return new Record($input->value, $input->comment);
19+
}
1520
}

0 commit comments

Comments
 (0)