Skip to content

Commit

Permalink
Merge pull request #49 from neos/task/adjust-to-moveContentRepository…
Browse files Browse the repository at this point in the history
…Id-to-correct-namespace

TASK: Adjust to movement of `ContentRepositoryId` to `SharedModel` namespace
  • Loading branch information
ahaeslich authored Mar 17, 2024
2 parents 8aa3119 + 98b8c76 commit c0b44f7
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion config/set/contentrepository-90.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,12 @@
\Neos\ContentRepository\Core\Dimension\ContentDimensionId::class => 'value',
\Neos\ContentRepository\Core\Dimension\ContentDimensionValue::class => 'value',
\Neos\ContentRepository\Core\Dimension\ContentDimensionValueSpecializationDepth::class => 'value',
\Neos\ContentRepository\Core\Factory\ContentRepositoryId::class => 'value',
\Neos\ContentRepository\Core\Feature\ContentStreamEventStreamName::class => 'value',
\Neos\ContentRepository\Core\Infrastructure\Property\PropertyType::class => 'value',
\Neos\ContentRepository\Core\NodeType\NodeType::class => 'name',
\Neos\ContentRepository\Core\NodeType\NodeTypeName::class => 'value',
\Neos\ContentRepository\Core\Projection\ContentGraph\NodePath::class => 'value',
\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::class => 'value',
\Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId::class => 'value',
\Neos\ContentRepository\Core\SharedModel\Node\NodeName::class => 'value',
\Neos\ContentRepository\Core\SharedModel\Node\PropertyName::class => 'value',
Expand Down
8 changes: 4 additions & 4 deletions docs/rules_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public function run()
{
- $combinations = $this->contentDimensionCombinator->getAllAllowedCombinations();
+ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
+ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
+ $dimensionSpacePoints = $contentRepository->getVariationGraph()->getDimensionSpacePoints();
+ // TODO 9.0 migration: try to directly work with $dimensionSpacePoints, instead of converting them to the legacy dimension format
+
Expand Down Expand Up @@ -112,7 +112,7 @@
{
- return $context->getRootNode();
+ // TODO 9.0 migration: !! MEGA DIRTY CODE! Ensure to rewrite this; by getting rid of LegacyContextStub.
+ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
+ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
+ $workspace = $contentRepository->getWorkspaceFinder()->findOneByName(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($context->workspaceName ?? 'live'));
+ $rootNodeAggregate = $contentRepository->getContentGraph()->findRootNodeAggregateByType($workspace->currentContentStreamId, \Neos\ContentRepository\Core\NodeType\NodeTypeName::fromString('Neos.Neos:Sites'));
+ $subgraph = $contentRepository->getContentGraph()->getSubgraph($workspace->currentContentStreamId, \Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint::fromLegacyDimensionArray($context->dimensions ?? []), $context->invisibleContentShown ? \Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints::withoutRestrictions() : \Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints::frontend());
Expand Down Expand Up @@ -1001,7 +1001,7 @@ return static function (RectorConfig $rectorConfig): void {
{
- $nt = $this->nodeTypeManager->getNodeTypes(false);
+ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
+ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
+ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
+ $nt = $contentRepository->getNodeTypeManager()->getNodeTypes(false);
}
}
Expand Down Expand Up @@ -1160,7 +1160,7 @@ return static function (RectorConfig $rectorConfig): void {
public function run(string $workspace)
{
- return $this->workspaceRepository->countByName($workspace);
+ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
+ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
+ // TODO 9.0 migration: remove ternary operator (...? 1 : 0 ) - unnecessary complexity
+
+ return $contentRepository->getWorkspaceFinder()->findOneByName(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($workspace)) !== null ? 1 : 0;
Expand Down
2 changes: 1 addition & 1 deletion src/ContentRepository90/Rules/Traits/ValueObjectTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
namespace Neos\Rector\ContentRepository90\Rules\Traits;

use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint;
use Neos\ContentRepository\Core\Factory\ContentRepositoryId;
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use PhpParser\Node\Expr;
use PhpParser\Node\Scalar\String_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SomeClass
protected $contentDimensionCombinator;
public function run()
{
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$dimensionSpacePoints = $contentRepository->getVariationGraph()->getDimensionSpacePoints();
// TODO 9.0 migration: try to directly work with $dimensionSpacePoints, instead of converting them to the legacy dimension format

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SomeClass
$nodeType = $node->getNodeType();
$grandParentsNodeType = $node->getParent()->getParent()->getNodeType();
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));

$contentRepository->getNodeTypeManager()->isNodeTypeAllowedAsChildToTetheredNode($grandParentsNodeType, \Neos\ContentRepository\Core\SharedModel\Node\NodeName::fromString($parentNodeName), $nodeType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SomeClass
{
$nodeType = $node->getNodeType();
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$childNodes = $contentRepository->getNodeTypeManager()->getTetheredNodesConfigurationForNodeType($nodeType);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SomeClass
public function run(NodeLegacyStub $node)
{
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$contentRepository->getNodeTypeManager()->getTetheredNodesConfigurationForNodeType($node->getNodeType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SomeClass
{
$parent = $node->getParent();
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$contentRepository->getNodeTypeManager()->getTetheredNodesConfigurationForNodeType($parent->getNodeType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SomeClass
public function run(NodeLegacyStub $node)
{
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$contentRepository->getNodeTypeManager()->getTetheredNodesConfigurationForNodeType($node->getParent()->getNodeType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class SomeClass
{
$nodeType = $node->getNodeType();
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
foreach ($contentRepository->getNodeTypeManager()->getTetheredNodesConfigurationForNodeType($nodeType) as $key => $_x) {
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SomeClass
$nodeName = NodeName::fromString('name');
$nodeType = $node->getNodeType();
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$type = $contentRepository->getNodeTypeManager()->getTypeOfTetheredNode($nodeType, $nodeName);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SomeClass
{
$nodeName = NodeName::fromString('name');
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$contentRepository->getNodeTypeManager()->getTypeOfTetheredNode($node->getNodeType(), $nodeName);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SomeClass
$nodeName = NodeName::fromString('name');
$parent = $node->getParent();
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$contentRepository->getNodeTypeManager()->getTypeOfTetheredNode($parent->getNodeType(), $nodeName);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SomeClass
public function run()
{
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$nt = $contentRepository->getNodeTypeManager()->getNodeTypes(false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SomeClass
protected \Neos\ContentRepositoryRegistry\ContentRepositoryRegistry $contentRepositoryRegistry;
public function run(string $workspace)
{
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
// TODO 9.0 migration: remove ternary operator (...? 1 : 0 ) - unnecessary complexity

return $contentRepository->getWorkspaceFinder()->findOneByName(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($workspace)) !== null ? 1 : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SomeClass
public function run(\Neos\Rector\ContentRepository90\Legacy\LegacyContextStub $context)
{
// TODO 9.0 migration: !! MEGA DIRTY CODE! Ensure to rewrite this; by getting rid of LegacyContextStub.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\Factory\ContentRepositoryId::fromString('default'));
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$workspace = $contentRepository->getWorkspaceFinder()->findOneByName(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($context->workspaceName ?? 'live'));
$rootNodeAggregate = $contentRepository->getContentGraph()->findRootNodeAggregateByType($workspace->currentContentStreamId, \Neos\ContentRepository\Core\NodeType\NodeTypeName::fromString('Neos.Neos:Sites'));
$subgraph = $contentRepository->getContentGraph()->getSubgraph($workspace->currentContentStreamId, \Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint::fromLegacyDimensionArray($context->dimensions ?? []), $context->invisibleContentShown ? \Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints::withoutRestrictions() : \Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints::frontend());
Expand Down

0 comments on commit c0b44f7

Please sign in to comment.