|
1 | 1 | <?php
|
| 2 | + |
2 | 3 | namespace Flowpack\DecoupledContentStore\NodeRendering\Render;
|
| 4 | + |
3 | 5 | use Flowpack\DecoupledContentStore\Aspects\CacheUrlMappingAspect;
|
4 | 6 | use Flowpack\DecoupledContentStore\Exception;
|
5 | 7 | use Flowpack\DecoupledContentStore\Core\Infrastructure\ContentReleaseLogger;
|
@@ -154,7 +156,7 @@ protected function buildControllerContextAndSetBaseUri(string $uri, NodeInterfac
|
154 | 156 | return new ControllerContext(
|
155 | 157 | $request,
|
156 | 158 | new ActionResponse(),
|
157 |
| - new Arguments(array()), |
| 159 | + new Arguments([]), |
158 | 160 | $uriBuilder
|
159 | 161 | );
|
160 | 162 | }
|
@@ -227,7 +229,7 @@ protected function renderDocumentView(NodeInterface $node, $uri, array $requestA
|
227 | 229 | );
|
228 | 230 | }
|
229 | 231 |
|
230 |
| - $contentReleaseLogger->debug('Rendering document for URI ' . $uri, ['baseUri' => $baseUri]); |
| 232 | + $contentReleaseLogger->info('Rendering document for URI ' . $uri, ['baseUri' => $baseUri]); |
231 | 233 |
|
232 | 234 | $controllerContext = $this->buildControllerContextAndSetBaseUri($uri, $node, $requestArguments);
|
233 | 235 | /** @var ActionRequest $request */
|
@@ -285,18 +287,24 @@ private static function wrapInHttpMessage(string $output, ActionResponse $respon
|
285 | 287 | * @param NodeInterface $node
|
286 | 288 | * @param array $arguments
|
287 | 289 | * @return string The resolved URI for the given node
|
| 290 | + * @throws \Exception |
288 | 291 | */
|
289 | 292 | protected function buildNodeUri(NodeInterface $node, array $arguments)
|
290 | 293 | {
|
291 | 294 | /** @var Site $currentSite */
|
292 | 295 | $currentSite = $node->getContext()->getCurrentSite();
|
293 | 296 | if (!$currentSite->hasActiveDomains()) {
|
294 |
| - throw new \Exception("No configured domain!"); |
| 297 | + throw new Exception(sprintf("Site %s has no active domain", $currentSite->getNodeName()), 1666684522); |
295 | 298 | }
|
| 299 | + $primaryDomain = $currentSite->getPrimaryDomain(); |
| 300 | + if ((string)$primaryDomain->getScheme() === '') { |
| 301 | + throw new Exception(sprintf("Domain %s for site %s has no scheme defined", $primaryDomain->getHostname(), $currentSite->getNodeName()), 1666684523); |
| 302 | + } |
| 303 | + |
296 | 304 | // HINT: We cannot use a static URL here, but instead need to use an URL of the current site.
|
297 | 305 | // This is changed from the the old behavior, where we have changed the LinkingService in LinkingServiceAspect,
|
298 | 306 | // to properly generate the domain part of the routes - and this relies on the proper ControllerContext URI path.
|
299 |
| - $baseControllerContext = $this->buildControllerContextAndSetBaseUri($currentSite->getPrimaryDomain()->__toString(), $node, $arguments); |
| 307 | + $baseControllerContext = $this->buildControllerContextAndSetBaseUri($primaryDomain->__toString(), $node, $arguments); |
300 | 308 | $format = $arguments['@format'] ?? 'html';
|
301 | 309 | $uri = $this->linkingService->createNodeUri($baseControllerContext, $node, null, $format, true, $arguments, '', false, [], false);
|
302 | 310 | return $this->removeQueryPartFromUri($uri);
|
|
0 commit comments