Skip to content

Commit

Permalink
Merge pull request #7 from gerhard-boden/fix-fallback-dimension-bug
Browse files Browse the repository at this point in the history
BUGFIX: Create redirects with correct ``sourceUri``
  • Loading branch information
hlubek authored Oct 19, 2016
2 parents efbed7e + 08e6c7c commit 3089dda
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Classes/Service/NodeRedirectService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
use TYPO3\Flow\Persistence\PersistenceManagerInterface;
use TYPO3\Neos\Domain\Model\Domain;
use TYPO3\Neos\Domain\Service\ContentContext;
use TYPO3\TYPO3CR\Domain\Service\ContextFactoryInterface;
use TYPO3\Neos\Routing\Exception;
use TYPO3\TYPO3CR\Domain\Model\NodeInterface;
use TYPO3\TYPO3CR\Domain\Model\Workspace;
use TYPO3\TYPO3CR\Domain\Repository\NodeDataRepository;
use TYPO3\TYPO3CR\Domain\Service\ContextFactory;

/**
* Service that creates redirects for moved / deleted nodes.
Expand Down Expand Up @@ -69,7 +69,7 @@ class NodeRedirectService implements NodeRedirectServiceInterface

/**
* @Flow\Inject
* @var ContextFactory
* @var ContextFactoryInterface
*/
protected $contextFactory;

Expand Down Expand Up @@ -98,8 +98,9 @@ public function createRedirectsForPublishedNode(NodeInterface $node, Workspace $
$context = $this->contextFactory->create([
'workspaceName' => 'live',
'invisibleContentShown' => true,
'dimensions' => $node->getDimensions()
'dimensions' => $node->getContext()->getDimensions()
]);

$targetNode = $context->getNodeByIdentifier($node->getIdentifier());
if ($targetNode === null) {
// The page has been added
Expand Down Expand Up @@ -130,12 +131,9 @@ public function createRedirectsForPublishedNode(NodeInterface $node, Workspace $
return;
}


$this->flushRoutingCacheForNode($targetNode);
$statusCode = (integer)$this->defaultStatusCode['redirect'];
$this->redirectStorage->addRedirect($targetNodeUriPath, $nodeUriPath, $statusCode, $hosts);
/** @var ContentContext $contentContext */


$q = new FlowQuery([$node]);
foreach ($q->children('[instanceof TYPO3.Neos:Document]') as $childrenNode) {
Expand Down

0 comments on commit 3089dda

Please sign in to comment.