Skip to content

Commit e376020

Browse files
committed
getResponseAdditionalLinks should not output URLs that could not be generated
1 parent aeed484 commit e376020

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Transformer/Transformer.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,14 @@ protected function getResponseAdditionalLinks(array $copy, $type)
274274
$type
275275
);
276276

277-
return \str_replace($idProperties, $idValues, $otherUrls);
277+
$replacedUrls = \str_replace($idProperties, $idValues, $otherUrls);
278+
foreach ($replacedUrls as $key => $value) {
279+
if ($otherUrls[$key] === $value && false !== strpos($value, '{')) {
280+
unset($replacedUrls[$key]);
281+
}
282+
}
283+
284+
return $replacedUrls;
278285
}
279286

280287
return [];
@@ -343,5 +350,5 @@ protected static function flattenObjectsWithSingleKeyScalars(array &$array)
343350
public function getMappings()
344351
{
345352
return $this->mappings;
346-
}
353+
}
347354
}

0 commit comments

Comments
 (0)