protected function parseRoutes(Mapper $mapper)
{
foreach ($mapper->getClassMap() as &$mapping) {
$mappingClass = new \ReflectionClass($mapping);
$this->setUrlWithReflection($mapping, $mappingClass, 'resourceUrlPattern');
$this->setUrlWithReflection($mapping, $mappingClass, 'selfUrl');
$mappingProperty = $mappingClass->getProperty('otherUrls');
$mappingProperty->setAccessible(true);
$otherUrls = (array) $mappingProperty->getValue($mapping);
if (!empty($otherUrls)) {
foreach ($otherUrls as &$url) {
if (!empty($url['name'])) {
$url = $this->calculateRoute($url);
}
}
}
$mappingProperty->setValue($mapping, $otherUrls);
$this->setJsonApiRelationships($mappingClass, $mapping);
}
return $mapper;
}