Skip to content

Commit

Permalink
fix: Add PreviewResolverInterface into NodeSourceWalkerContext to alt…
Browse files Browse the repository at this point in the history
…er TreeWalker definition against preview status
  • Loading branch information
ambroisemaupate committed May 11, 2023
1 parent 3c65cae commit 463be2e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use RZ\Roadiz\CoreBundle\Bag\NodeTypes;
use RZ\Roadiz\CoreBundle\EntityApi\NodeSourceApi;
use RZ\Roadiz\CoreBundle\NodeType\NodeTypeResolver;
use RZ\Roadiz\CoreBundle\Preview\PreviewResolverInterface;
use RZ\TreeWalker\WalkerContextInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
Expand All @@ -24,6 +25,7 @@ class NodeSourceWalkerContext implements WalkerContextInterface
private ManagerRegistry $managerRegistry;
private CacheItemPoolInterface $cacheAdapter;
private NodeTypeResolver $nodeTypeResolver;
private PreviewResolverInterface $previewResolver;

public function __construct(
Stopwatch $stopwatch,
Expand All @@ -33,6 +35,7 @@ public function __construct(
ManagerRegistry $managerRegistry,
CacheItemPoolInterface $cacheAdapter,
NodeTypeResolver $nodeTypeResolver,
PreviewResolverInterface $previewResolver
) {
$this->stopwatch = $stopwatch;
$this->nodeTypesBag = $nodeTypesBag;
Expand All @@ -41,6 +44,7 @@ public function __construct(
$this->managerRegistry = $managerRegistry;
$this->cacheAdapter = $cacheAdapter;
$this->nodeTypeResolver = $nodeTypeResolver;
$this->previewResolver = $previewResolver;
}

/**
Expand Down Expand Up @@ -123,4 +127,12 @@ public function getNodeTypeResolver(): NodeTypeResolver
{
return $this->nodeTypeResolver;
}

/**
* @return PreviewResolverInterface
*/
public function getPreviewResolver(): PreviewResolverInterface
{
return $this->previewResolver;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use RZ\Roadiz\CoreBundle\Bag\NodeTypes;
use RZ\Roadiz\CoreBundle\EntityApi\NodeSourceApi;
use RZ\Roadiz\CoreBundle\NodeType\NodeTypeResolver;
use RZ\Roadiz\CoreBundle\Preview\PreviewResolverInterface;
use RZ\TreeWalker\WalkerContextInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Stopwatch\Stopwatch;
Expand All @@ -22,6 +23,7 @@ final class NodeSourceWalkerContextFactory implements WalkerContextFactoryInterf
private ManagerRegistry $managerRegistry;
private CacheItemPoolInterface $cacheAdapter;
private NodeTypeResolver $nodeTypeResolver;
private PreviewResolverInterface $previewResolver;

public function __construct(
Stopwatch $stopwatch,
Expand All @@ -30,7 +32,8 @@ public function __construct(
RequestStack $requestStack,
ManagerRegistry $managerRegistry,
CacheItemPoolInterface $cacheAdapter,
NodeTypeResolver $nodeTypeResolver
NodeTypeResolver $nodeTypeResolver,
PreviewResolverInterface $previewResolver
) {
$this->stopwatch = $stopwatch;
$this->nodeTypesBag = $nodeTypesBag;
Expand All @@ -39,6 +42,7 @@ public function __construct(
$this->managerRegistry = $managerRegistry;
$this->cacheAdapter = $cacheAdapter;
$this->nodeTypeResolver = $nodeTypeResolver;
$this->previewResolver = $previewResolver;
}

public function createWalkerContext(): WalkerContextInterface
Expand All @@ -50,7 +54,8 @@ public function createWalkerContext(): WalkerContextInterface
$this->requestStack,
$this->managerRegistry,
$this->cacheAdapter,
$this->nodeTypeResolver
$this->nodeTypeResolver,
$this->previewResolver
);
}
}

0 comments on commit 463be2e

Please sign in to comment.