From 8df7547ab26e4a010eafe64e786be02777d79623 Mon Sep 17 00:00:00 2001 From: Sabrina Sauter Date: Sat, 27 Jul 2024 11:30:04 +0200 Subject: [PATCH 1/9] chore: changes for neos 9 beta10 - method argument and property changes. --- Classes/Command/TaxonomyCommandController.php | 4 +- Classes/Controller/ModuleController.php | 48 ++++++++++--------- .../SecondaryInspectorController.php | 2 +- Classes/FlowQuery/CreateNodeHashTrait.php | 4 +- .../ReferencedTaxonomiesOperation.php | 2 +- .../ReferencingTaxonomiesOperation.php | 2 +- Classes/FlowQuery/SubTaxonomiesOperation.php | 2 +- .../FlowQuery/WithSubTaxonomiesOperation.php | 2 +- Classes/Service/TaxonomyService.php | 19 ++++---- 9 files changed, 42 insertions(+), 43 deletions(-) diff --git a/Classes/Command/TaxonomyCommandController.php b/Classes/Command/TaxonomyCommandController.php index cfd197c..d873284 100644 --- a/Classes/Command/TaxonomyCommandController.php +++ b/Classes/Command/TaxonomyCommandController.php @@ -45,7 +45,7 @@ public function vocabulariesCommand(): void $this->output->outputTable( array_map( fn(Node $node) => [ - $node->nodeName?->value ?? $node->nodeAggregateId->value, + $node->nodeName?->value ?? $node->aggregateId, $node->getProperty('title'), $node->getProperty('description') ], @@ -93,7 +93,7 @@ private function subtreeToTableRowsRecursively(Subtree $subtree): array { $rows = array_map(fn(Subtree $subtree)=>$this->subtreeToTableRowsRecursively($subtree), $subtree->children); $row = [ - str_repeat(' ', $subtree->level) . ($subtree->node->nodeName?->value ?? $subtree->node->nodeAggregateId->value), + str_repeat(' ', $subtree->level) . ($subtree->node->nodeName?->value ?? $subtree->node->aggregateId), (string) $subtree->node->getProperty('title'), (string) $subtree->node->getProperty('description') ]; diff --git a/Classes/Controller/ModuleController.php b/Classes/Controller/ModuleController.php index cbbf311..e604c86 100644 --- a/Classes/Controller/ModuleController.php +++ b/Classes/Controller/ModuleController.php @@ -178,11 +178,11 @@ public function createVocabularyAction(string $rootNodeAddress, string $name, ar $nodeTypeName = $this->taxonomyService->getVocabularyNodeTypeName(); $commandResult = $contentRepository->handle( CreateNodeAggregateWithNode::create( - $liveWorkspace->currentContentStreamId, + $liveWorkspace->workspaceName, $nodeAggregateId, $nodeTypeName, $originDimensionSpacePoint, - $rootNode->nodeAggregateId, + $rootNode->aggregateId, null, NodeName::transliterateFromString($name), PropertyValuesToWrite::fromArray($properties) @@ -199,7 +199,7 @@ public function createVocabularyAction(string $rootNodeAddress, string $name, ar $contentRepository->handle( CreateNodeVariant::create( - $liveWorkspace->currentContentStreamId, + $liveWorkspace->workspaceName, $nodeAggregateId, $originDimensionSpacePoint, $originDimensionSpacePoint2 @@ -227,12 +227,12 @@ public function createVocabularyAction(string $rootNodeAddress, string $name, ar public function editVocabularyAction(string $vocabularyNodeAddress): void { $contentRepository = $this->taxonomyService->getContentRepository(); + $liveWorkspace = $this->taxonomyService->getLiveWorkspace(); $vocabularyNode = $this->taxonomyService->getNodeByNodeAddress($vocabularyNodeAddress); - $subgraph = $contentRepository->getContentGraph()->getSubgraph( - $vocabularyNode->subgraphIdentity->contentStreamId, + $subgraph = $contentRepository->getContentGraph($liveWorkspace->workspaceName)->getSubgraph( $vocabularyNode->subgraphIdentity->dimensionSpacePoint, - $vocabularyNode->subgraphIdentity->visibilityConstraints, + $vocabularyNode->subgraphIdentity->visibilityConstraints ); $rootNode = $this->taxonomyService->findOrCreateRoot($subgraph); @@ -250,12 +250,13 @@ public function updateVocabularyAction(string $vocabularyNodeAddress, string $na { $vocabularyNode = $this->taxonomyService->getNodeByNodeAddress($vocabularyNodeAddress); $subgraph = $this->taxonomyService->getSubgraphForNode($vocabularyNode); + $liveWorkspace = $this->taxonomyService->getLiveWorkspace(); $rootNode = $this->taxonomyService->findOrCreateRoot($subgraph); $commandResult = $this->contentRepository->handle( SetNodeProperties::create( - $vocabularyNode->subgraphIdentity->contentStreamId, - $vocabularyNode->nodeAggregateId, + $liveWorkspace->workspaceName, + $vocabularyNode->aggregateId, $vocabularyNode->originDimensionSpacePoint, PropertyValuesToWrite::fromArray($properties) ) @@ -264,8 +265,8 @@ public function updateVocabularyAction(string $vocabularyNodeAddress, string $na if ($name != $vocabularyNode->nodeName?->value) { $commandResult = $this->contentRepository->handle( ChangeNodeAggregateName::create( - $vocabularyNode->subgraphIdentity->contentStreamId, - $vocabularyNode->nodeAggregateId, + $liveWorkspace->workspaceName, + $vocabularyNode->aggregateId, NodeName::transliterateFromString($name) ) ); @@ -274,7 +275,7 @@ public function updateVocabularyAction(string $vocabularyNodeAddress, string $na $commandResult->block(); $this->rebaseCurrentUserWorkspace(); - $updatedVocabularyNode = $subgraph->findNodeById($vocabularyNode->nodeAggregateId); + $updatedVocabularyNode = $subgraph->findNodeById($vocabularyNode->aggregateId); if ($updatedVocabularyNode) { $this->addFlashMessage( @@ -297,8 +298,8 @@ public function deleteVocabularyAction(string $vocabularyNodeAddress): void $commandResult = $this->contentRepository->handle( RemoveNodeAggregate::create( - $liveWorkspace->currentContentStreamId, - $vocabularyNode->nodeAggregateId, + $liveWorkspace->workspaceName, + $vocabularyNode->aggregateId, $vocabularyNode->originDimensionSpacePoint->toDimensionSpacePoint(), NodeVariantSelectionStrategy::STRATEGY_ALL_VARIANTS ) @@ -359,11 +360,11 @@ public function createTaxonomyAction(string $parentNodeAddress, string $name, ar $nodeTypeName = $this->taxonomyService->getTaxonomyNodeTypeName(); $commandResult = $this->contentRepository->handle( CreateNodeAggregateWithNode::create( - $liveWorkspace->currentContentStreamId, + $liveWorkspace->workspaceName, $nodeAggregateId, $nodeTypeName, $originDimensionSpacePoint, - $parentNode->nodeAggregateId, + $parentNode->aggregateId, null, NodeName::transliterateFromString($name), PropertyValuesToWrite::fromArray($properties) @@ -380,7 +381,7 @@ public function createTaxonomyAction(string $parentNodeAddress, string $name, ar $commandResult = $this->contentRepository->handle( CreateNodeVariant::create( - $liveWorkspace->currentContentStreamId, + $liveWorkspace->workspaceName, $nodeAggregateId, $originDimensionSpacePoint, $originDimensionSpacePoint2 @@ -428,11 +429,12 @@ public function updateTaxonomyAction(string $taxonomyNodeAddress, string $name, $taxonomyNode = $this->taxonomyService->getNodeByNodeAddress($taxonomyNodeAddress); $vocabularyNode = $this->taxonomyService->findVocabularyForNode($taxonomyNode); $subgraph = $this->taxonomyService->getSubgraphForNode($taxonomyNode); + $liveWorkspace = $this->taxonomyService->getLiveWorkspace(); $commandResult = $this->contentRepository->handle( SetNodeProperties::create( - $taxonomyNode->subgraphIdentity->contentStreamId, - $taxonomyNode->nodeAggregateId, + $liveWorkspace->workspaceName, + $taxonomyNode->aggregateId, $taxonomyNode->originDimensionSpacePoint, PropertyValuesToWrite::fromArray($properties) ) @@ -440,8 +442,8 @@ public function updateTaxonomyAction(string $taxonomyNodeAddress, string $name, if ($name != $taxonomyNode->nodeName?->value) { $commandResult = $this->contentRepository->handle( ChangeNodeAggregateName::create( - $taxonomyNode->subgraphIdentity->contentStreamId, - $taxonomyNode->nodeAggregateId, + $liveWorkspace->workspaceName, + $taxonomyNode->aggregateId, NodeName::transliterateFromString($name) ) ); @@ -449,7 +451,7 @@ public function updateTaxonomyAction(string $taxonomyNodeAddress, string $name, $commandResult->block(); $this->rebaseCurrentUserWorkspace(); - $updatedTaxonomyNode = $subgraph->findNodeById($vocabularyNode->nodeAggregateId); + $updatedTaxonomyNode = $subgraph->findNodeById($vocabularyNode->aggregateId); if ($updatedTaxonomyNode) { $this->addFlashMessage( @@ -471,8 +473,8 @@ public function deleteTaxonomyAction(string $taxonomyNodeAddress): void $commandResult = $this->contentRepository->handle( RemoveNodeAggregate::create( - $liveWorkspace->currentContentStreamId, - $taxonomyNode->nodeAggregateId, + $liveWorkspace->workspaceName, + $taxonomyNode->aggregateId, $taxonomyNode->originDimensionSpacePoint->toDimensionSpacePoint(), NodeVariantSelectionStrategy::STRATEGY_ALL_VARIANTS ) diff --git a/Classes/Controller/SecondaryInspectorController.php b/Classes/Controller/SecondaryInspectorController.php index d92b13b..3238fba 100644 --- a/Classes/Controller/SecondaryInspectorController.php +++ b/Classes/Controller/SecondaryInspectorController.php @@ -69,7 +69,7 @@ protected function toJson(Subtree $subtree, string $pathSoFar = null): array $label = $subtree->node->getLabel(); $pathSegment = $subtree->node->nodeName?->value ?? $label; $path = $pathSoFar ? $pathSoFar . ' - ' . $pathSegment : $pathSegment; - $identifier = $subtree->node->nodeAggregateId->value; + $identifier = $subtree->node->aggregateId; $nodeType = $subtree->node->nodeTypeName->value; $title = $subtree->node->getProperty('title'); $description = $subtree->node->getProperty('description'); diff --git a/Classes/FlowQuery/CreateNodeHashTrait.php b/Classes/FlowQuery/CreateNodeHashTrait.php index 89b0b55..ad8ef85 100644 --- a/Classes/FlowQuery/CreateNodeHashTrait.php +++ b/Classes/FlowQuery/CreateNodeHashTrait.php @@ -9,7 +9,7 @@ trait CreateNodeHashTrait { /** - * Create a string hash containing the nodeAggregateId, cr-id, contentStream->id, dimensionSpacePoint->hash + * Create a string hash containing the aggregateId, cr-id, contentStream->id, dimensionSpacePoint->hash * and visibilityConstraints->hash. To be used for ensuring uniqueness or removing nodes. * * @see Node::equals() for comparison @@ -20,7 +20,7 @@ protected function createNodeHash(Node $node): string implode( ':', [ - $node->nodeAggregateId->value, + $node->aggregateId, $node->subgraphIdentity->contentRepositoryId->value, $node->subgraphIdentity->contentStreamId->value, $node->subgraphIdentity->dimensionSpacePoint->hash, diff --git a/Classes/FlowQuery/ReferencedTaxonomiesOperation.php b/Classes/FlowQuery/ReferencedTaxonomiesOperation.php index 61445fb..b750a9d 100644 --- a/Classes/FlowQuery/ReferencedTaxonomiesOperation.php +++ b/Classes/FlowQuery/ReferencedTaxonomiesOperation.php @@ -69,7 +69,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments) */ foreach ($flowQuery->getContext() as $node) { $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node); - $references = $subgraph->findReferences($node->nodeAggregateId, $findReferencesFilter); + $references = $subgraph->findReferences($node->aggregateId, $findReferencesFilter); foreach ($references as $reference) { $nodes[] = $reference->node; } diff --git a/Classes/FlowQuery/ReferencingTaxonomiesOperation.php b/Classes/FlowQuery/ReferencingTaxonomiesOperation.php index b8b36c4..1adc530 100644 --- a/Classes/FlowQuery/ReferencingTaxonomiesOperation.php +++ b/Classes/FlowQuery/ReferencingTaxonomiesOperation.php @@ -61,7 +61,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments) */ foreach ($flowQuery->getContext() as $node) { $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node); - $references = $subgraph->findBackReferences($node->nodeAggregateId, $findBackReferencesFilter); + $references = $subgraph->findBackReferences($node->aggregateId, $findBackReferencesFilter); foreach ($references as $reference) { $nodes[] = $reference->node; } diff --git a/Classes/FlowQuery/SubTaxonomiesOperation.php b/Classes/FlowQuery/SubTaxonomiesOperation.php index d1a4c7b..013ea95 100644 --- a/Classes/FlowQuery/SubTaxonomiesOperation.php +++ b/Classes/FlowQuery/SubTaxonomiesOperation.php @@ -67,7 +67,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments) foreach ($flowQuery->getContext() as $node) { $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node); - $subtree = $subgraph->findSubtree($node->nodeAggregateId, $filter); + $subtree = $subgraph->findSubtree($node->aggregateId, $filter); if ($subtree) { foreach ($subtree->children as $child) { $nodes = $nodes->merge($this->flattenSubtree($child)); diff --git a/Classes/FlowQuery/WithSubTaxonomiesOperation.php b/Classes/FlowQuery/WithSubTaxonomiesOperation.php index 25c8a02..7a68af7 100644 --- a/Classes/FlowQuery/WithSubTaxonomiesOperation.php +++ b/Classes/FlowQuery/WithSubTaxonomiesOperation.php @@ -70,7 +70,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments) $nodes = Nodes::createEmpty(); foreach ($flowQuery->getContext() as $node) { $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node); - $subtree = $subgraph->findSubtree($node->nodeAggregateId, $filter); + $subtree = $subgraph->findSubtree($node->aggregateId, $filter); if ($subtree) { $nodes = $nodes->merge($this->flattenSubtree($subtree)); } diff --git a/Classes/Service/TaxonomyService.php b/Classes/Service/TaxonomyService.php index bc42328..900ac8a 100644 --- a/Classes/Service/TaxonomyService.php +++ b/Classes/Service/TaxonomyService.php @@ -16,7 +16,7 @@ namespace Sitegeist\Taxonomy\Service; use Neos\ContentRepository\Core\ContentRepository; -use Neos\ContentRepository\Core\Factory\ContentRepositoryId; +use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; use Neos\ContentRepository\Core\Feature\RootNodeCreation\Command\CreateRootNodeAggregateWithNode; use Neos\ContentRepository\Core\NodeType\NodeTypeName; use Neos\ContentRepository\Core\NodeType\NodeTypeNames; @@ -82,7 +82,7 @@ public function findVocabularyForNode(Node $node): Node $subgraph = $this->crRegistry->subgraphForNode($node); $vocabularyNode = $subgraph->findClosestNode( - $node->nodeAggregateId, + $node->aggregateId, FindClosestNodeFilter::create( nodeTypes: NodeTypeCriteria::create( NodeTypeNames::fromArray([ $this->getVocabularyNodeTypeName()]), @@ -110,7 +110,7 @@ public function findOrCreateRoot(ContentSubgraphInterface $subgraph): Node $commandResult = $contentRepository->handle( CreateRootNodeAggregateWithNode::create( - $liveWorkspace->currentContentStreamId, + $liveWorkspace->workspaceName, NodeAggregateId::create(), $this->getRootNodeTypeName() ) @@ -129,7 +129,7 @@ public function findAllVocabularies(ContentSubgraphInterface $subgraph): Nodes { $root = $this->findOrCreateRoot($subgraph); return $subgraph->findChildNodes( - $root->nodeAggregateId, + $root->aggregateId, FindChildNodesFilter::create( nodeTypes: NodeTypeCriteria::create( NodeTypeNames::fromArray([$this->getVocabularyNodeTypeName()]), @@ -159,7 +159,7 @@ public function findTaxonomyByVocabularyNameAndPath(ContentSubgraphInterface $su } $taxonomy = $subgraph->findNodeByPath( NodePath::fromString($taxonomyPath), - $vocabulary->nodeAggregateId + $vocabulary->aggregateId ); return $taxonomy; } @@ -169,7 +169,7 @@ public function findSubtree(Node $StartNode): ?Subtree $subgraph = $this->crRegistry->subgraphForNode($StartNode); $vocabularySubtree = $subgraph->findSubtree( - $StartNode->nodeAggregateId, + $StartNode->aggregateId, FindSubtreeFilter::create( nodeTypes: NodeTypeCriteria::create( NodeTypeNames::fromArray([$this->getTaxonomyNodeTypeName(), $this->getVocabularyNodeTypeName()]), @@ -203,8 +203,7 @@ public function getNodeByNodeAddress(string $serializedNodeAddress): Node { $contentRepository = $this->getContentRepository(); $nodeAddress = NodeAddressFactory::create($contentRepository)->createFromUriString($serializedNodeAddress); - $subgraph = $contentRepository->getContentGraph()->getSubgraph( - $nodeAddress->contentStreamId, + $subgraph = $contentRepository->getContentGraph(WorkspaceName::forLive())->getSubgraph( $nodeAddress->dimensionSpacePoint, VisibilityConstraints::withoutRestrictions() ); @@ -218,15 +217,13 @@ public function getNodeByNodeAddress(string $serializedNodeAddress): Node public function getDefaultSubgraph(): ContentSubgraphInterface { $contentRepository = $this->getContentRepository(); - $liveWorkspace = $this->getLiveWorkspace(); $generalizations = $contentRepository->getVariationGraph()->getRootGeneralizations(); $dimensionSpacePoint = reset($generalizations); if (!$dimensionSpacePoint) { throw new \Exception('default dimensionSpacePoint could not be found'); } - $contentGraph = $contentRepository->getContentGraph(); + $contentGraph = $contentRepository->getContentGraph(WorkspaceName::forLive()); $subgraph = $contentGraph->getSubgraph( - $liveWorkspace->currentContentStreamId, $dimensionSpacePoint, VisibilityConstraints::withoutRestrictions() ); From a8ee61fab830ca4ef75bf26a666d8dd7e1a7648f Mon Sep 17 00:00:00 2001 From: Sabrina Sauter Date: Mon, 19 Aug 2024 15:02:47 +0200 Subject: [PATCH 2/9] chore: changes for neos 9 beta-11. See https://discuss.neos.io/t/neos-9-beta-11-release/6618 --- Classes/Command/TaxonomyCommandController.php | 4 +-- Classes/Controller/ModuleController.php | 32 +++++++++++-------- .../SecondaryInspectorController.php | 8 +++-- Classes/Service/TaxonomyService.php | 9 +++--- .../Fusion/Backend/Form/Taxonomy.fusion | 2 +- .../Fusion/Backend/Form/Vocabulary.fusion | 2 +- .../Fusion/Backend/Views/Taxonomy.Edit.fusion | 2 +- .../Fusion/Backend/Views/Taxonomy.List.fusion | 10 +++--- .../Fusion/Backend/Views/Taxonomy.New.fusion | 2 +- .../Backend/Views/Vocabulary.Edit.fusion | 2 +- .../Backend/Views/Vocabulary.List.fusion | 6 ++-- 11 files changed, 44 insertions(+), 35 deletions(-) diff --git a/Classes/Command/TaxonomyCommandController.php b/Classes/Command/TaxonomyCommandController.php index d873284..7d0594b 100644 --- a/Classes/Command/TaxonomyCommandController.php +++ b/Classes/Command/TaxonomyCommandController.php @@ -45,7 +45,7 @@ public function vocabulariesCommand(): void $this->output->outputTable( array_map( fn(Node $node) => [ - $node->nodeName?->value ?? $node->aggregateId, + $node->name?->value ?? $node->aggregateId, $node->getProperty('title'), $node->getProperty('description') ], @@ -93,7 +93,7 @@ private function subtreeToTableRowsRecursively(Subtree $subtree): array { $rows = array_map(fn(Subtree $subtree)=>$this->subtreeToTableRowsRecursively($subtree), $subtree->children); $row = [ - str_repeat(' ', $subtree->level) . ($subtree->node->nodeName?->value ?? $subtree->node->aggregateId), + str_repeat(' ', $subtree->level) . ($subtree->node->name?->value ?? $subtree->node->aggregateId), (string) $subtree->node->getProperty('title'), (string) $subtree->node->getProperty('description') ]; diff --git a/Classes/Controller/ModuleController.php b/Classes/Controller/ModuleController.php index e604c86..2f5aaf7 100644 --- a/Classes/Controller/ModuleController.php +++ b/Classes/Controller/ModuleController.php @@ -38,6 +38,7 @@ use Neos\Neos\FrontendRouting\NodeAddressFactory; use Neos\Neos\Fusion\Helper\DimensionHelper; use Neos\Neos\Fusion\Helper\NodeHelper; +use Neos\Neos\Domain\NodeLabel\NodeLabelGeneratorInterface; use Sitegeist\Taxonomy\Service\TaxonomyService; use Neos\Utility\Arrays; @@ -72,6 +73,9 @@ class ModuleController extends ActionController #[Flow\Inject(lazy: false)] protected SecurityContext $securityContext; + #[Flow\Inject] + protected NodeLabelGeneratorInterface $nodeLabelGenerator; + protected ContentRepository $contentRepository; protected NodeAddressFactory $nodeAddressFactory; @@ -188,7 +192,7 @@ public function createVocabularyAction(string $rootNodeAddress, string $name, ar PropertyValuesToWrite::fromArray($properties) ) ); - $commandResult->block(); + $commandResult; // create required generalizations foreach ($generalizations as $dimensionSpacePoint) { @@ -213,7 +217,7 @@ public function createVocabularyAction(string $rootNodeAddress, string $name, ar if ($newVocabularyNode) { $this->addFlashMessage( - sprintf('Created vocabulary %s', $newVocabularyNode->getLabel()), + sprintf('Created vocabulary %s', $this->nodeLabelGenerator->getLabel($newVocabularyNode)), 'Create Vocabulary' ); } @@ -262,7 +266,7 @@ public function updateVocabularyAction(string $vocabularyNodeAddress, string $na ) ); - if ($name != $vocabularyNode->nodeName?->value) { + if ($name != $vocabularyNode->name?->value) { $commandResult = $this->contentRepository->handle( ChangeNodeAggregateName::create( $liveWorkspace->workspaceName, @@ -272,14 +276,14 @@ public function updateVocabularyAction(string $vocabularyNodeAddress, string $na ); } - $commandResult->block(); + $commandResult; $this->rebaseCurrentUserWorkspace(); $updatedVocabularyNode = $subgraph->findNodeById($vocabularyNode->aggregateId); if ($updatedVocabularyNode) { $this->addFlashMessage( - sprintf('Updated vocabulary %s', $updatedVocabularyNode->getLabel()) + sprintf('Updated vocabulary %s', $this->nodeLabelGenerator->getLabel($updatedVocabularyNode)) ); } @@ -304,11 +308,11 @@ public function deleteVocabularyAction(string $vocabularyNodeAddress): void NodeVariantSelectionStrategy::STRATEGY_ALL_VARIANTS ) ); - $commandResult->block(); + $commandResult; $this->rebaseCurrentUserWorkspace(); $this->addFlashMessage( - sprintf('Deleted vocabulary %s', $vocabularyNode->getLabel()) + sprintf('Deleted vocabulary %s', $this->nodeLabelGenerator->getLabel($vocabularyNode)) ); $this->redirect('index', null, null, ['rootNodeAddress' => $this->nodeAddressFactory->createFromNode($rootNode)]); @@ -370,7 +374,7 @@ public function createTaxonomyAction(string $parentNodeAddress, string $name, ar PropertyValuesToWrite::fromArray($properties) ) ); - $commandResult->block(); + $commandResult; // create required generalizations foreach ($generalizations as $dimensionSpacePoint) { @@ -394,7 +398,7 @@ public function createTaxonomyAction(string $parentNodeAddress, string $name, ar if ($newTaxonomyNode) { $this->addFlashMessage( - sprintf('Created taxonomy %s', $newTaxonomyNode->getLabel()), + sprintf('Created taxonomy %s', $this->nodeLabelGenerator->getLabel($newTaxonomyNode)), 'Create taxomony' ); } @@ -439,7 +443,7 @@ public function updateTaxonomyAction(string $taxonomyNodeAddress, string $name, PropertyValuesToWrite::fromArray($properties) ) ); - if ($name != $taxonomyNode->nodeName?->value) { + if ($name != $taxonomyNode->name?->value) { $commandResult = $this->contentRepository->handle( ChangeNodeAggregateName::create( $liveWorkspace->workspaceName, @@ -448,14 +452,14 @@ public function updateTaxonomyAction(string $taxonomyNodeAddress, string $name, ) ); } - $commandResult->block(); + $commandResult; $this->rebaseCurrentUserWorkspace(); $updatedTaxonomyNode = $subgraph->findNodeById($vocabularyNode->aggregateId); if ($updatedTaxonomyNode) { $this->addFlashMessage( - sprintf('Updated taxonomy %s', $updatedTaxonomyNode->getLabel()) + sprintf('Updated taxonomy %s', $this->nodeLabelGenerator->getLabel($updatedTaxonomyNode)) ); } @@ -479,11 +483,11 @@ public function deleteTaxonomyAction(string $taxonomyNodeAddress): void NodeVariantSelectionStrategy::STRATEGY_ALL_VARIANTS ) ); - $commandResult->block(); + $commandResult; $this->rebaseCurrentUserWorkspace(); $this->addFlashMessage( - sprintf('Deleted taxonomy %s', $taxonomyNode->getLabel()) + sprintf('Deleted taxonomy %s', $this->nodeLabelGenerator->getLabel($taxonomyNode)) ); $this->redirect('vocabulary', null, null, ['vocabularyNodeAddress' => $this->nodeAddressFactory->createFromNode($vocabularyNode)]); diff --git a/Classes/Controller/SecondaryInspectorController.php b/Classes/Controller/SecondaryInspectorController.php index 3238fba..0c1c716 100644 --- a/Classes/Controller/SecondaryInspectorController.php +++ b/Classes/Controller/SecondaryInspectorController.php @@ -17,6 +17,7 @@ use Neos\ContentRepository\Core\Projection\ContentGraph\AbsoluteNodePath; use Neos\ContentRepository\Core\Projection\ContentGraph\Subtree; +use Neos\Neos\Domain\NodeLabel\NodeLabelGeneratorInterface; use Neos\Flow\Annotations as Flow; use Neos\Flow\Mvc\Controller\ActionController; use Neos\Flow\Mvc\View\JsonView; @@ -34,6 +35,9 @@ class SecondaryInspectorController extends ActionController */ protected $taxonomyService; + #[Flow\Inject] + protected NodeLabelGeneratorInterface $nodeLabelGenerator; + /** * @var string[] */ @@ -66,8 +70,8 @@ public function treeAction(string $contextNode, string $startingPoint): void */ protected function toJson(Subtree $subtree, string $pathSoFar = null): array { - $label = $subtree->node->getLabel(); - $pathSegment = $subtree->node->nodeName?->value ?? $label; + $label = $this->nodeLabelGenerator->getLabel($subtree->node); + $pathSegment = $subtree->node->name?->value ?? $label; $path = $pathSoFar ? $pathSoFar . ' - ' . $pathSegment : $pathSegment; $identifier = $subtree->node->aggregateId; $nodeType = $subtree->node->nodeTypeName->value; diff --git a/Classes/Service/TaxonomyService.php b/Classes/Service/TaxonomyService.php index 900ac8a..c01e335 100644 --- a/Classes/Service/TaxonomyService.php +++ b/Classes/Service/TaxonomyService.php @@ -31,6 +31,7 @@ use Neos\ContentRepository\Core\Projection\ContentGraph\Subtree; use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints; use Neos\ContentRepository\Core\Projection\Workspace\Workspace; +use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; @@ -115,7 +116,7 @@ public function findOrCreateRoot(ContentSubgraphInterface $subgraph): Node $this->getRootNodeTypeName() ) ); - $commandResult->block(); + $commandResult; $rootNode = $subgraph->findRootNodeByType($this->getRootNodeTypeName()); if ($rootNode instanceof Node) { @@ -190,7 +191,7 @@ private function orderSubtreeByNameRecursive(Subtree $subtree): Subtree ); usort( $children, - fn(Subtree $a, Subtree $b) => $a->node->nodeName?->value <=> $b->node->nodeName?->value + fn(Subtree $a, Subtree $b) => $a->node->name?->value <=> $b->node->name?->value ); return new Subtree( $subtree->level, @@ -202,12 +203,12 @@ private function orderSubtreeByNameRecursive(Subtree $subtree): Subtree public function getNodeByNodeAddress(string $serializedNodeAddress): Node { $contentRepository = $this->getContentRepository(); - $nodeAddress = NodeAddressFactory::create($contentRepository)->createFromUriString($serializedNodeAddress); + $nodeAddress = NodeAddress::fromJsonString($serializedNodeAddress); $subgraph = $contentRepository->getContentGraph(WorkspaceName::forLive())->getSubgraph( $nodeAddress->dimensionSpacePoint, VisibilityConstraints::withoutRestrictions() ); - $node = $subgraph->findNodeById($nodeAddress->nodeAggregateId); + $node = $subgraph->findNodeById($nodeAddress->aggregateId); if (is_null($node)) { throw new \InvalidArgumentException('nodeAddress does not resolve to a node'); } diff --git a/Resources/Private/Fusion/Backend/Form/Taxonomy.fusion b/Resources/Private/Fusion/Backend/Form/Taxonomy.fusion index 5b9f3de..ed5cc55 100644 --- a/Resources/Private/Fusion/Backend/Form/Taxonomy.fusion +++ b/Resources/Private/Fusion/Backend/Form/Taxonomy.fusion @@ -13,7 +13,7 @@ prototype(Sitegeist.Taxonomy:Form.Taxonomy) < prototype(Neos.Fusion:Component) { renderer = afx` diff --git a/Resources/Private/Fusion/Backend/Form/Vocabulary.fusion b/Resources/Private/Fusion/Backend/Form/Vocabulary.fusion index 8cee6ed..04598ba 100644 --- a/Resources/Private/Fusion/Backend/Form/Vocabulary.fusion +++ b/Resources/Private/Fusion/Backend/Form/Vocabulary.fusion @@ -13,7 +13,7 @@ prototype(Sitegeist.Taxonomy:Form.Vocabulary) < prototype(Neos.Fusion:Component) renderer = afx` diff --git a/Resources/Private/Fusion/Backend/Views/Taxonomy.Edit.fusion b/Resources/Private/Fusion/Backend/Views/Taxonomy.Edit.fusion index 18e1d05..c06a4dc 100644 --- a/Resources/Private/Fusion/Backend/Views/Taxonomy.Edit.fusion +++ b/Resources/Private/Fusion/Backend/Views/Taxonomy.Edit.fusion @@ -5,7 +5,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Taxonomy.Edit) < prototype(Neos.Fusion i18nTaxonomy = ${Translation.value('').package("Sitegeist.Taxonomy").source('NodeTypes/Taxonomy')} renderer = afx` - {props.i18nMain.id('taxon')}: {taxonomyNode.properties.title} [{taxonomyNode.nodeName.value}] + {props.i18nMain.id('taxon')}: {taxonomyNode.properties.title} [{taxonomyNode.name.value}] - {props.i18n.id('vocabulary')} "{vocabularyNode.properties.title}" [{vocabularyNode.nodeName.value}] + {props.i18n.id('vocabulary')} "{vocabularyNode.properties.title}" [{vocabularyNode.name.value}]
1}>       - +     - {props.taxonomySubtree.node.properties.title} [{props.taxonomySubtree.node.nodeName.value}] + {props.taxonomySubtree.node.properties.title} [{props.taxonomySubtree.node.name.value}] {props.taxonomySubtree.node.properties.description} @@ -112,12 +112,12 @@ prototype(Sitegeist.Taxonomy:Views.Module.Taxonomy.List.Item) < prototype(Neos.F -
+
diff --git a/Resources/Private/Fusion/Backend/Views/Taxonomy.New.fusion b/Resources/Private/Fusion/Backend/Views/Taxonomy.New.fusion index 67ca02c..4e9a7b5 100644 --- a/Resources/Private/Fusion/Backend/Views/Taxonomy.New.fusion +++ b/Resources/Private/Fusion/Backend/Views/Taxonomy.New.fusion @@ -4,7 +4,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Taxonomy.New) < prototype(Neos.Fusion: i18nTaxonomy = ${Translation.value('').package("Sitegeist.Taxonomy").source('NodeTypes/Taxonomy')} renderer = afx` - {props.i18nMain.id('taxon.createBelow')}: "{parentNode.properties.title}" [{parentNode.nodeName.value}] + {props.i18nMain.id('taxon.createBelow')}: "{parentNode.properties.title}" [{parentNode.name.value}] - {props.i18nMain.id('vocabulary')}: "{vocabularyNode.properties.title}" [{vocabularyNode.nodeName.value}] + {props.i18nMain.id('vocabulary')}: "{vocabularyNode.properties.title}" [{vocabularyNode.name.value}] {props.i18nMain.id('generic.default')}: {defaultVocabulary.properties.title}

- {vocabulary.properties.title} [{vocabulary.nodeName.value}] + {vocabulary.properties.title} [{vocabulary.name.value}]

@@ -59,7 +59,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Vocabulary.List) < prototype(Neos.Fusi   - @@ -69,7 +69,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Vocabulary.List) < prototype(Neos.Fusi
-
+
From 21239a476513675a5b2958ce8403f0bdd4ce1a6b Mon Sep 17 00:00:00 2001 From: Sabrina Sauter Date: Mon, 26 Aug 2024 09:22:02 +0200 Subject: [PATCH 3/9] chore: remove deprecated usage of `NodeAddressFactory`. --- Classes/Controller/ModuleController.php | 24 +++++++++++------------- Classes/Service/TaxonomyService.php | 1 - 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Classes/Controller/ModuleController.php b/Classes/Controller/ModuleController.php index 2f5aaf7..ddab653 100644 --- a/Classes/Controller/ModuleController.php +++ b/Classes/Controller/ModuleController.php @@ -35,11 +35,11 @@ use Neos\Flow\Security\Context as SecurityContext; use Neos\Fusion\View\FusionView; use Neos\Neos\Domain\Service\WorkspaceNameBuilder; -use Neos\Neos\FrontendRouting\NodeAddressFactory; use Neos\Neos\Fusion\Helper\DimensionHelper; use Neos\Neos\Fusion\Helper\NodeHelper; use Neos\Neos\Domain\NodeLabel\NodeLabelGeneratorInterface; use Sitegeist\Taxonomy\Service\TaxonomyService; +use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress; use Neos\Utility\Arrays; /** @@ -78,12 +78,10 @@ class ModuleController extends ActionController protected ContentRepository $contentRepository; - protected NodeAddressFactory $nodeAddressFactory; public function initializeObject(): void { $this->contentRepository = $this->taxonomyService->getContentRepository(); - $this->nodeAddressFactory = NodeAddressFactory::create($this->contentRepository); } public function initializeView(ViewInterface $view): void @@ -111,7 +109,7 @@ public function indexAction(string $rootNodeAddress = null): void $vocabularies = $this->taxonomyService->findAllVocabularies($subgraph); $this->view->assign('rootNode', $rootNode); - $this->view->assign('rootNodeAddress', $this->nodeAddressFactory->createFromNode($rootNode)->serializeForUri()); + $this->view->assign('rootNodeAddress', NodeAddress::fromNode($rootNode)->toJson()); $this->view->assign('vocabularies', $vocabularies); } @@ -174,7 +172,8 @@ public function createVocabularyAction(string $rootNodeAddress, string $name, ar $subgraph = $this->taxonomyService->getSubgraphForNode($rootNode); $liveWorkspace = $this->taxonomyService->getLiveWorkspace(); $generalizations = $contentRepository->getVariationGraph()->getRootGeneralizations(); - $nodeAddress = $this->nodeAddressFactory->createFromUriString($rootNodeAddress); + $nodeAddress = NodeAddress::fromJsonString($rootNodeAddress); + $originDimensionSpacePoint = OriginDimensionSpacePoint::fromDimensionSpacePoint($nodeAddress->dimensionSpacePoint); // create node @@ -287,7 +286,7 @@ public function updateVocabularyAction(string $vocabularyNodeAddress, string $na ); } - $this->redirect('index', null, null, ['rootNodeAddress' => $this->nodeAddressFactory->createFromNode($rootNode)]); + $this->redirect('index', null, null, ['rootNodeAddress' => NodeAddress::fromNode($rootNode)]); } /** @@ -315,7 +314,7 @@ public function deleteVocabularyAction(string $vocabularyNodeAddress): void sprintf('Deleted vocabulary %s', $this->nodeLabelGenerator->getLabel($vocabularyNode)) ); - $this->redirect('index', null, null, ['rootNodeAddress' => $this->nodeAddressFactory->createFromNode($rootNode)]); + $this->redirect('index', null, null, ['rootNodeAddress' => NodeAddress::fromNode($rootNode)]); } /** @@ -356,7 +355,7 @@ public function createTaxonomyAction(string $parentNodeAddress, string $name, ar $liveWorkspace = $this->taxonomyService->getLiveWorkspace(); $generalizations = $this->contentRepository->getVariationGraph()->getRootGeneralizations(); - $nodeAddress = $this->nodeAddressFactory->createFromUriString($parentNodeAddress); + $nodeAddress = NodeAddress::fromJsonString($parentNodeAddress); $originDimensionSpacePoint = OriginDimensionSpacePoint::fromDimensionSpacePoint($nodeAddress->dimensionSpacePoint); // create node @@ -370,7 +369,6 @@ public function createTaxonomyAction(string $parentNodeAddress, string $name, ar $originDimensionSpacePoint, $parentNode->aggregateId, null, - NodeName::transliterateFromString($name), PropertyValuesToWrite::fromArray($properties) ) ); @@ -383,7 +381,7 @@ public function createTaxonomyAction(string $parentNodeAddress, string $name, ar continue; } - $commandResult = $this->contentRepository->handle( + $this->contentRepository->handle( CreateNodeVariant::create( $liveWorkspace->workspaceName, $nodeAggregateId, @@ -407,7 +405,7 @@ public function createTaxonomyAction(string $parentNodeAddress, string $name, ar 'vocabulary', null, null, - ['vocabularyNodeAddress' => $this->nodeAddressFactory->createFromNode($vocabularyNode)] + ['vocabularyNodeAddress' => NodeAddress::fromNode($vocabularyNode)] ); } @@ -463,7 +461,7 @@ public function updateTaxonomyAction(string $taxonomyNodeAddress, string $name, ); } - $this->redirect('vocabulary', null, null, ['vocabularyNodeAddress' => $this->nodeAddressFactory->createFromNode($vocabularyNode)]); + $this->redirect('vocabulary', null, null, ['vocabularyNodeAddress' => NodeAddress::fromNode($vocabularyNode)]); } /** @@ -490,7 +488,7 @@ public function deleteTaxonomyAction(string $taxonomyNodeAddress): void sprintf('Deleted taxonomy %s', $this->nodeLabelGenerator->getLabel($taxonomyNode)) ); - $this->redirect('vocabulary', null, null, ['vocabularyNodeAddress' => $this->nodeAddressFactory->createFromNode($vocabularyNode)]); + $this->redirect('vocabulary', null, null, ['vocabularyNodeAddress' => NodeAddress::fromNode($vocabularyNode)]); } protected function rebaseCurrentUserWorkspace(): void diff --git a/Classes/Service/TaxonomyService.php b/Classes/Service/TaxonomyService.php index c01e335..a0965e9 100644 --- a/Classes/Service/TaxonomyService.php +++ b/Classes/Service/TaxonomyService.php @@ -36,7 +36,6 @@ use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Flow\Annotations as Flow; -use Neos\Neos\FrontendRouting\NodeAddressFactory; class TaxonomyService { From e914c9b5275da97f548129c97a3950df90a44dfe Mon Sep 17 00:00:00 2001 From: Sabrina Sauter Date: Mon, 26 Aug 2024 12:06:40 +0200 Subject: [PATCH 4/9] chore: fix `editVocabularyAction`. --- Classes/Controller/ModuleController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/Controller/ModuleController.php b/Classes/Controller/ModuleController.php index ddab653..6a4f3ce 100644 --- a/Classes/Controller/ModuleController.php +++ b/Classes/Controller/ModuleController.php @@ -234,8 +234,8 @@ public function editVocabularyAction(string $vocabularyNodeAddress): void $vocabularyNode = $this->taxonomyService->getNodeByNodeAddress($vocabularyNodeAddress); $subgraph = $contentRepository->getContentGraph($liveWorkspace->workspaceName)->getSubgraph( - $vocabularyNode->subgraphIdentity->dimensionSpacePoint, - $vocabularyNode->subgraphIdentity->visibilityConstraints + $vocabularyNode->dimensionSpacePoint, + $vocabularyNode->visibilityConstraints ); $rootNode = $this->taxonomyService->findOrCreateRoot($subgraph); From 185acaabb95b8ec966d67d519dd796c7f3d6d4f6 Mon Sep 17 00:00:00 2001 From: Sabrina Sauter Date: Tue, 27 Aug 2024 12:03:09 +0200 Subject: [PATCH 5/9] chore: fix node creation in `createVocabularyAction`. --- Classes/Controller/ModuleController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Classes/Controller/ModuleController.php b/Classes/Controller/ModuleController.php index 6a4f3ce..df26dcc 100644 --- a/Classes/Controller/ModuleController.php +++ b/Classes/Controller/ModuleController.php @@ -187,7 +187,6 @@ public function createVocabularyAction(string $rootNodeAddress, string $name, ar $originDimensionSpacePoint, $rootNode->aggregateId, null, - NodeName::transliterateFromString($name), PropertyValuesToWrite::fromArray($properties) ) ); From 5244528d15df41e65abe68ce18de7e4fdb989b74 Mon Sep 17 00:00:00 2001 From: Sabrina Sauter Date: Thu, 19 Sep 2024 10:57:52 +0200 Subject: [PATCH 6/9] chore: fix getting of node in `TaxonomyEditor`. --- Classes/Controller/SecondaryInspectorController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Classes/Controller/SecondaryInspectorController.php b/Classes/Controller/SecondaryInspectorController.php index 0c1c716..812fc38 100644 --- a/Classes/Controller/SecondaryInspectorController.php +++ b/Classes/Controller/SecondaryInspectorController.php @@ -22,6 +22,8 @@ use Neos\Flow\Mvc\Controller\ActionController; use Neos\Flow\Mvc\View\JsonView; use Sitegeist\Taxonomy\Service\TaxonomyService; +use Neos\Neos\Ui\ContentRepository\Service\NeosUiNodeService; +use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult; /** * Class SecondaryInspectorController @@ -38,6 +40,9 @@ class SecondaryInspectorController extends ActionController #[Flow\Inject] protected NodeLabelGeneratorInterface $nodeLabelGenerator; + #[Flow\Inject] + protected NeosUiNodeService $nodeService; + /** * @var string[] */ @@ -50,7 +55,8 @@ class SecondaryInspectorController extends ActionController public function treeAction(string $contextNode, string $startingPoint): void { - $node = $this->taxonomyService->getNodeByNodeAddress($contextNode); + $contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest())->contentRepositoryId; + $node = $this->nodeService->findNodeBySerializedNodeAddress($contextNode, $contentRepositoryId); $subgraph = $this->taxonomyService->getSubgraphForNode($node); $path = AbsoluteNodePath::fromString($startingPoint); From 57e58960a355c9c8a589beba060e878615ec1876 Mon Sep 17 00:00:00 2001 From: Sabrina Sauter Date: Fri, 27 Sep 2024 09:32:28 +0200 Subject: [PATCH 7/9] chore: get dimensions by content repository id, not context node `Sitegeist.Taxonomy:Root`, because a root node has no "translated" dimensionSpacePoint in the first place. --- Classes/Controller/ModuleController.php | 3 +++ .../Fusion/Backend/Fragments/DimensionSelector.fusion | 10 +++++----- .../Private/Fusion/Backend/Views/Taxonomy.List.fusion | 1 + .../Fusion/Backend/Views/Vocabulary.List.fusion | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Classes/Controller/ModuleController.php b/Classes/Controller/ModuleController.php index df26dcc..1ddfd94 100644 --- a/Classes/Controller/ModuleController.php +++ b/Classes/Controller/ModuleController.php @@ -40,6 +40,7 @@ use Neos\Neos\Domain\NodeLabel\NodeLabelGeneratorInterface; use Sitegeist\Taxonomy\Service\TaxonomyService; use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress; +use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; use Neos\Utility\Arrays; /** @@ -108,6 +109,7 @@ public function indexAction(string $rootNodeAddress = null): void $vocabularies = $this->taxonomyService->findAllVocabularies($subgraph); + $this->view->assign('contentRepositoryId', ContentRepositoryId::fromString('default')); $this->view->assign('rootNode', $rootNode); $this->view->assign('rootNodeAddress', NodeAddress::fromNode($rootNode)->toJson()); $this->view->assign('vocabularies', $vocabularies); @@ -145,6 +147,7 @@ public function vocabularyAction(string $vocabularyNodeAddress): void $rootNode = $this->taxonomyService->findOrCreateRoot($subgraph); $vocabularySubtree = $this->taxonomyService->findSubtree($vocabularyNode); + $this->view->assign('contentRepositoryId', ContentRepositoryId::fromString('default')); $this->view->assign('rootNode', $rootNode); $this->view->assign('vocabularyNode', $vocabularyNode); $this->view->assign('vocabularySubtree', $vocabularySubtree); diff --git a/Resources/Private/Fusion/Backend/Fragments/DimensionSelector.fusion b/Resources/Private/Fusion/Backend/Fragments/DimensionSelector.fusion index b8f2741..8c403e5 100644 --- a/Resources/Private/Fusion/Backend/Fragments/DimensionSelector.fusion +++ b/Resources/Private/Fusion/Backend/Fragments/DimensionSelector.fusion @@ -3,6 +3,7 @@ prototype(Sitegeist.Taxonomy:Views.Fragments.DimensionSelector) < prototype(Neos targetAction = null targetProperty = null contextNode = null + contentRepositoryId = null renderer = afx` - + {iterator.isFirst ? '' : ' '} - {String.firstLetterToUpperCase(dimensionKey)}: {Neos.Dimension.currentValue(props.contextNode, dimensionKey).value} - - {String.firstLetterToUpperCase(dimensionKey)}: {dimensionValue.value} - + + {String.firstLetterToUpperCase(dimensionKey)}: {dimensionValue.value} + diff --git a/Resources/Private/Fusion/Backend/Views/Taxonomy.List.fusion b/Resources/Private/Fusion/Backend/Views/Taxonomy.List.fusion index 919142a..f14197c 100644 --- a/Resources/Private/Fusion/Backend/Views/Taxonomy.List.fusion +++ b/Resources/Private/Fusion/Backend/Views/Taxonomy.List.fusion @@ -13,6 +13,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Taxonomy.List) < prototype(Neos.Fusion targetAction='vocabulary' targetProperty='vocabularyNodeAddress' contextNode={vocabularyNode} + contentRepositoryId={contentRepositoryId} />
diff --git a/Resources/Private/Fusion/Backend/Views/Vocabulary.List.fusion b/Resources/Private/Fusion/Backend/Views/Vocabulary.List.fusion index 081088c..0505a71 100644 --- a/Resources/Private/Fusion/Backend/Views/Vocabulary.List.fusion +++ b/Resources/Private/Fusion/Backend/Views/Vocabulary.List.fusion @@ -12,6 +12,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Vocabulary.List) < prototype(Neos.Fusi targetAction='index' targetProperty='rootNodeAddress' contextNode={rootNode} + contentRepositoryId={contentRepositoryId} />
From 3d07dc3fdc57370b9ab649b705c8963bff319f27 Mon Sep 17 00:00:00 2001 From: Sabrina Sauter Date: Mon, 28 Oct 2024 09:38:50 +0100 Subject: [PATCH 8/9] chore: Neos 9 Beta14 - fixes and adaptions after refactoring and deprecations. --- Classes/Controller/ModuleController.php | 24 +++++++++++-------- Classes/Service/TaxonomyService.php | 2 +- NodeTypes/Taxonomy.yaml | 2 +- NodeTypes/Vocabulary.yaml | 2 +- .../Fusion/Backend/Form/Taxonomy.fusion | 2 +- .../Fusion/Backend/Form/Vocabulary.fusion | 2 +- .../Fusion/Backend/Views/Taxonomy.Edit.fusion | 2 +- .../Fusion/Backend/Views/Taxonomy.List.fusion | 10 ++++---- .../Fusion/Backend/Views/Taxonomy.New.fusion | 2 +- .../Backend/Views/Vocabulary.Edit.fusion | 2 +- .../Backend/Views/Vocabulary.List.fusion | 6 ++--- 11 files changed, 30 insertions(+), 26 deletions(-) diff --git a/Classes/Controller/ModuleController.php b/Classes/Controller/ModuleController.php index 1ddfd94..011355e 100644 --- a/Classes/Controller/ModuleController.php +++ b/Classes/Controller/ModuleController.php @@ -26,6 +26,7 @@ use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Command\RebaseWorkspace; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepository\Core\Projection\Workspace\Workspace; +use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeName; use Neos\ContentRepository\Core\SharedModel\Node\NodeVariantSelectionStrategy; @@ -34,13 +35,15 @@ use Neos\Flow\Annotations as Flow; use Neos\Flow\Security\Context as SecurityContext; use Neos\Fusion\View\FusionView; -use Neos\Neos\Domain\Service\WorkspaceNameBuilder; +use Neos\Neos\Domain\Service\WorkspaceService; +use Neos\Neos\Service\UserService; use Neos\Neos\Fusion\Helper\DimensionHelper; use Neos\Neos\Fusion\Helper\NodeHelper; use Neos\Neos\Domain\NodeLabel\NodeLabelGeneratorInterface; use Sitegeist\Taxonomy\Service\TaxonomyService; use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress; use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; +use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult; use Neos\Utility\Arrays; /** @@ -79,6 +82,11 @@ class ModuleController extends ActionController protected ContentRepository $contentRepository; + #[Flow\Inject] + protected WorkspaceService $workspaceService; + + #[Flow\Inject] + protected UserService $userService; public function initializeObject(): void { @@ -495,17 +503,13 @@ public function deleteTaxonomyAction(string $taxonomyNodeAddress): void protected function rebaseCurrentUserWorkspace(): void { - $account = $this->securityContext->getAccount(); - if (is_null($account)) { - throw new \Exception('no account found'); - } - $workspaceName = WorkspaceNameBuilder::fromAccountIdentifier( - $account->getAccountIdentifier() - ); - $workspace = $this->contentRepository->getWorkspaceFinder()->findOneByName($workspaceName); + $contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest())->contentRepositoryId; + $user = $this->userService->getBackendUser(); + $workspace = $this->workspaceService->getPersonalWorkspaceForUser($contentRepositoryId, $user->getId()); + if (is_null($workspace)) { throw new \Exception('no workspace found'); } - $this->contentRepository->handle(RebaseWorkspace::create($workspaceName)); + $this->contentRepository->handle(RebaseWorkspace::create(WorkspaceName::fromString($workspace->workspaceName->value))); } } diff --git a/Classes/Service/TaxonomyService.php b/Classes/Service/TaxonomyService.php index a0965e9..a5978de 100644 --- a/Classes/Service/TaxonomyService.php +++ b/Classes/Service/TaxonomyService.php @@ -237,7 +237,7 @@ public function getSubgraphForNode(Node $node): ContentSubgraphInterface public function getLiveWorkspace(): Workspace { - $liveWorkspace = $this->getContentRepository()->getWorkspaceFinder()->findOneByName(WorkspaceName::forLive()); + $liveWorkspace = $this->getContentRepository()->findWorkspaceByName(WorkspaceName::forLive()); if (!$liveWorkspace) { throw new \Exception('live workspace could not be found'); } diff --git a/NodeTypes/Taxonomy.yaml b/NodeTypes/Taxonomy.yaml index c17014a..d21b408 100644 --- a/NodeTypes/Taxonomy.yaml +++ b/NodeTypes/Taxonomy.yaml @@ -1,5 +1,5 @@ Sitegeist.Taxonomy:Taxonomy: - label: "${String.stripTags(q(node).property('title'))}" + label: "${String.stripTags(node.properties.title)}" ui: label: i18n icon: 'icon-tag' diff --git a/NodeTypes/Vocabulary.yaml b/NodeTypes/Vocabulary.yaml index 89657a7..91b3b4a 100644 --- a/NodeTypes/Vocabulary.yaml +++ b/NodeTypes/Vocabulary.yaml @@ -1,5 +1,5 @@ Sitegeist.Taxonomy:Vocabulary: - label: "${String.stripTags(q(node).property('title'))}" + label: "${String.stripTags(node.properties.title)}" ui: label: i18n icon: 'icon-tags' diff --git a/Resources/Private/Fusion/Backend/Form/Taxonomy.fusion b/Resources/Private/Fusion/Backend/Form/Taxonomy.fusion index ed5cc55..cdb6f5c 100644 --- a/Resources/Private/Fusion/Backend/Form/Taxonomy.fusion +++ b/Resources/Private/Fusion/Backend/Form/Taxonomy.fusion @@ -13,7 +13,7 @@ prototype(Sitegeist.Taxonomy:Form.Taxonomy) < prototype(Neos.Fusion:Component) { renderer = afx` diff --git a/Resources/Private/Fusion/Backend/Form/Vocabulary.fusion b/Resources/Private/Fusion/Backend/Form/Vocabulary.fusion index 04598ba..0e5c87b 100644 --- a/Resources/Private/Fusion/Backend/Form/Vocabulary.fusion +++ b/Resources/Private/Fusion/Backend/Form/Vocabulary.fusion @@ -13,7 +13,7 @@ prototype(Sitegeist.Taxonomy:Form.Vocabulary) < prototype(Neos.Fusion:Component) renderer = afx` diff --git a/Resources/Private/Fusion/Backend/Views/Taxonomy.Edit.fusion b/Resources/Private/Fusion/Backend/Views/Taxonomy.Edit.fusion index c06a4dc..b86c9f5 100644 --- a/Resources/Private/Fusion/Backend/Views/Taxonomy.Edit.fusion +++ b/Resources/Private/Fusion/Backend/Views/Taxonomy.Edit.fusion @@ -5,7 +5,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Taxonomy.Edit) < prototype(Neos.Fusion i18nTaxonomy = ${Translation.value('').package("Sitegeist.Taxonomy").source('NodeTypes/Taxonomy')} renderer = afx` - {props.i18nMain.id('taxon')}: {taxonomyNode.properties.title} [{taxonomyNode.name.value}] + {props.i18nMain.id('taxon')}: {taxonomyNode.properties.title} [{taxonomyNode.name}] - {props.i18n.id('vocabulary')} "{vocabularyNode.properties.title}" [{vocabularyNode.name.value}] + {props.i18n.id('vocabulary')} "{vocabularyNode.properties.title}" [{vocabularyNode.name}]
1}>       - +     - {props.taxonomySubtree.node.properties.title} [{props.taxonomySubtree.node.name.value}] + {props.taxonomySubtree.node.properties.title} [{props.taxonomySubtree.node.name}] {props.taxonomySubtree.node.properties.description} @@ -113,12 +113,12 @@ prototype(Sitegeist.Taxonomy:Views.Module.Taxonomy.List.Item) < prototype(Neos.F -
+
diff --git a/Resources/Private/Fusion/Backend/Views/Taxonomy.New.fusion b/Resources/Private/Fusion/Backend/Views/Taxonomy.New.fusion index 4e9a7b5..412ce29 100644 --- a/Resources/Private/Fusion/Backend/Views/Taxonomy.New.fusion +++ b/Resources/Private/Fusion/Backend/Views/Taxonomy.New.fusion @@ -4,7 +4,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Taxonomy.New) < prototype(Neos.Fusion: i18nTaxonomy = ${Translation.value('').package("Sitegeist.Taxonomy").source('NodeTypes/Taxonomy')} renderer = afx` - {props.i18nMain.id('taxon.createBelow')}: "{parentNode.properties.title}" [{parentNode.name.value}] + {props.i18nMain.id('taxon.createBelow')}: "{parentNode.properties.title}" [{parentNode.name}] - {props.i18nMain.id('vocabulary')}: "{vocabularyNode.properties.title}" [{vocabularyNode.name.value}] + {props.i18nMain.id('vocabulary')}: "{vocabularyNode.properties.title}" [{vocabularyNode.name}] {props.i18nMain.id('generic.default')}: {defaultVocabulary.properties.title}

- {vocabulary.properties.title} [{vocabulary.name.value}] + {vocabulary.properties.title} [{vocabulary.name}]

@@ -60,7 +60,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Vocabulary.List) < prototype(Neos.Fusi   - @@ -70,7 +70,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Vocabulary.List) < prototype(Neos.Fusi
-
+
From a07ea8b592e786f0d189e53106923f0b4b0197e1 Mon Sep 17 00:00:00 2001 From: Sabrina Sauter Date: Wed, 13 Nov 2024 07:51:20 +0100 Subject: [PATCH 9/9] Revert "chore: Neos 9 Beta14 - fixes and adaptions after refactoring and deprecations." This reverts commit 3d07dc3fdc57370b9ab649b705c8963bff319f27. --- Classes/Controller/ModuleController.php | 24 ++++++++----------- Classes/Service/TaxonomyService.php | 2 +- NodeTypes/Taxonomy.yaml | 2 +- NodeTypes/Vocabulary.yaml | 2 +- .../Fusion/Backend/Form/Taxonomy.fusion | 2 +- .../Fusion/Backend/Form/Vocabulary.fusion | 2 +- .../Fusion/Backend/Views/Taxonomy.Edit.fusion | 2 +- .../Fusion/Backend/Views/Taxonomy.List.fusion | 10 ++++---- .../Fusion/Backend/Views/Taxonomy.New.fusion | 2 +- .../Backend/Views/Vocabulary.Edit.fusion | 2 +- .../Backend/Views/Vocabulary.List.fusion | 6 ++--- 11 files changed, 26 insertions(+), 30 deletions(-) diff --git a/Classes/Controller/ModuleController.php b/Classes/Controller/ModuleController.php index 011355e..1ddfd94 100644 --- a/Classes/Controller/ModuleController.php +++ b/Classes/Controller/ModuleController.php @@ -26,7 +26,6 @@ use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Command\RebaseWorkspace; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepository\Core\Projection\Workspace\Workspace; -use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepository\Core\SharedModel\Node\NodeName; use Neos\ContentRepository\Core\SharedModel\Node\NodeVariantSelectionStrategy; @@ -35,15 +34,13 @@ use Neos\Flow\Annotations as Flow; use Neos\Flow\Security\Context as SecurityContext; use Neos\Fusion\View\FusionView; -use Neos\Neos\Domain\Service\WorkspaceService; -use Neos\Neos\Service\UserService; +use Neos\Neos\Domain\Service\WorkspaceNameBuilder; use Neos\Neos\Fusion\Helper\DimensionHelper; use Neos\Neos\Fusion\Helper\NodeHelper; use Neos\Neos\Domain\NodeLabel\NodeLabelGeneratorInterface; use Sitegeist\Taxonomy\Service\TaxonomyService; use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress; use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; -use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult; use Neos\Utility\Arrays; /** @@ -82,11 +79,6 @@ class ModuleController extends ActionController protected ContentRepository $contentRepository; - #[Flow\Inject] - protected WorkspaceService $workspaceService; - - #[Flow\Inject] - protected UserService $userService; public function initializeObject(): void { @@ -503,13 +495,17 @@ public function deleteTaxonomyAction(string $taxonomyNodeAddress): void protected function rebaseCurrentUserWorkspace(): void { - $contentRepositoryId = SiteDetectionResult::fromRequest($this->request->getHttpRequest())->contentRepositoryId; - $user = $this->userService->getBackendUser(); - $workspace = $this->workspaceService->getPersonalWorkspaceForUser($contentRepositoryId, $user->getId()); - + $account = $this->securityContext->getAccount(); + if (is_null($account)) { + throw new \Exception('no account found'); + } + $workspaceName = WorkspaceNameBuilder::fromAccountIdentifier( + $account->getAccountIdentifier() + ); + $workspace = $this->contentRepository->getWorkspaceFinder()->findOneByName($workspaceName); if (is_null($workspace)) { throw new \Exception('no workspace found'); } - $this->contentRepository->handle(RebaseWorkspace::create(WorkspaceName::fromString($workspace->workspaceName->value))); + $this->contentRepository->handle(RebaseWorkspace::create($workspaceName)); } } diff --git a/Classes/Service/TaxonomyService.php b/Classes/Service/TaxonomyService.php index a5978de..a0965e9 100644 --- a/Classes/Service/TaxonomyService.php +++ b/Classes/Service/TaxonomyService.php @@ -237,7 +237,7 @@ public function getSubgraphForNode(Node $node): ContentSubgraphInterface public function getLiveWorkspace(): Workspace { - $liveWorkspace = $this->getContentRepository()->findWorkspaceByName(WorkspaceName::forLive()); + $liveWorkspace = $this->getContentRepository()->getWorkspaceFinder()->findOneByName(WorkspaceName::forLive()); if (!$liveWorkspace) { throw new \Exception('live workspace could not be found'); } diff --git a/NodeTypes/Taxonomy.yaml b/NodeTypes/Taxonomy.yaml index d21b408..c17014a 100644 --- a/NodeTypes/Taxonomy.yaml +++ b/NodeTypes/Taxonomy.yaml @@ -1,5 +1,5 @@ Sitegeist.Taxonomy:Taxonomy: - label: "${String.stripTags(node.properties.title)}" + label: "${String.stripTags(q(node).property('title'))}" ui: label: i18n icon: 'icon-tag' diff --git a/NodeTypes/Vocabulary.yaml b/NodeTypes/Vocabulary.yaml index 91b3b4a..89657a7 100644 --- a/NodeTypes/Vocabulary.yaml +++ b/NodeTypes/Vocabulary.yaml @@ -1,5 +1,5 @@ Sitegeist.Taxonomy:Vocabulary: - label: "${String.stripTags(node.properties.title)}" + label: "${String.stripTags(q(node).property('title'))}" ui: label: i18n icon: 'icon-tags' diff --git a/Resources/Private/Fusion/Backend/Form/Taxonomy.fusion b/Resources/Private/Fusion/Backend/Form/Taxonomy.fusion index cdb6f5c..ed5cc55 100644 --- a/Resources/Private/Fusion/Backend/Form/Taxonomy.fusion +++ b/Resources/Private/Fusion/Backend/Form/Taxonomy.fusion @@ -13,7 +13,7 @@ prototype(Sitegeist.Taxonomy:Form.Taxonomy) < prototype(Neos.Fusion:Component) { renderer = afx` diff --git a/Resources/Private/Fusion/Backend/Form/Vocabulary.fusion b/Resources/Private/Fusion/Backend/Form/Vocabulary.fusion index 0e5c87b..04598ba 100644 --- a/Resources/Private/Fusion/Backend/Form/Vocabulary.fusion +++ b/Resources/Private/Fusion/Backend/Form/Vocabulary.fusion @@ -13,7 +13,7 @@ prototype(Sitegeist.Taxonomy:Form.Vocabulary) < prototype(Neos.Fusion:Component) renderer = afx` diff --git a/Resources/Private/Fusion/Backend/Views/Taxonomy.Edit.fusion b/Resources/Private/Fusion/Backend/Views/Taxonomy.Edit.fusion index b86c9f5..c06a4dc 100644 --- a/Resources/Private/Fusion/Backend/Views/Taxonomy.Edit.fusion +++ b/Resources/Private/Fusion/Backend/Views/Taxonomy.Edit.fusion @@ -5,7 +5,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Taxonomy.Edit) < prototype(Neos.Fusion i18nTaxonomy = ${Translation.value('').package("Sitegeist.Taxonomy").source('NodeTypes/Taxonomy')} renderer = afx` - {props.i18nMain.id('taxon')}: {taxonomyNode.properties.title} [{taxonomyNode.name}] + {props.i18nMain.id('taxon')}: {taxonomyNode.properties.title} [{taxonomyNode.name.value}] - {props.i18n.id('vocabulary')} "{vocabularyNode.properties.title}" [{vocabularyNode.name}] + {props.i18n.id('vocabulary')} "{vocabularyNode.properties.title}" [{vocabularyNode.name.value}]
1}>       - +     - {props.taxonomySubtree.node.properties.title} [{props.taxonomySubtree.node.name}] + {props.taxonomySubtree.node.properties.title} [{props.taxonomySubtree.node.name.value}] {props.taxonomySubtree.node.properties.description} @@ -113,12 +113,12 @@ prototype(Sitegeist.Taxonomy:Views.Module.Taxonomy.List.Item) < prototype(Neos.F -
+
diff --git a/Resources/Private/Fusion/Backend/Views/Taxonomy.New.fusion b/Resources/Private/Fusion/Backend/Views/Taxonomy.New.fusion index 412ce29..4e9a7b5 100644 --- a/Resources/Private/Fusion/Backend/Views/Taxonomy.New.fusion +++ b/Resources/Private/Fusion/Backend/Views/Taxonomy.New.fusion @@ -4,7 +4,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Taxonomy.New) < prototype(Neos.Fusion: i18nTaxonomy = ${Translation.value('').package("Sitegeist.Taxonomy").source('NodeTypes/Taxonomy')} renderer = afx` - {props.i18nMain.id('taxon.createBelow')}: "{parentNode.properties.title}" [{parentNode.name}] + {props.i18nMain.id('taxon.createBelow')}: "{parentNode.properties.title}" [{parentNode.name.value}] - {props.i18nMain.id('vocabulary')}: "{vocabularyNode.properties.title}" [{vocabularyNode.name}] + {props.i18nMain.id('vocabulary')}: "{vocabularyNode.properties.title}" [{vocabularyNode.name.value}] {props.i18nMain.id('generic.default')}: {defaultVocabulary.properties.title}

- {vocabulary.properties.title} [{vocabulary.name}] + {vocabulary.properties.title} [{vocabulary.name.value}]

@@ -60,7 +60,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Vocabulary.List) < prototype(Neos.Fusi   - @@ -70,7 +70,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Vocabulary.List) < prototype(Neos.Fusi
-
+