// below instead)
$attributes =
$reference->attributes;
$reference->attributes =
[];
// The request format and locale might have been overridden by the user
foreach (['_format', '_locale'
] as $key) { if (isset($attributes[$key])) { $reference->attributes
[$key] =
$attributes[$key];
} } $uri =
$this->
generateFragmentUri($uri,
$request, false, false
);
$reference->attributes =
array_merge($attributes,
$reference->attributes
);
} $subRequest =
$this->
createSubRequest($uri,
$request);
// override Request attributes as they can be objects (which are not supported by the generated URI)
if (null !==
$reference) { $subRequest->attributes->
add($reference->attributes
);
}