From 2f938cd4a4d5df946580d8efe50ab836d9f99f2f Mon Sep 17 00:00:00 2001 From: Wilhelm Behncke <2522299+grebaldi@users.noreply.github.com> Date: Wed, 28 Nov 2018 09:15:03 +0100 Subject: [PATCH 1/4] BUGFIX: Forward `removedContentShown` in Context->getNodeByIdentifier() fixes #2292 --- Classes/Domain/Service/Context.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Domain/Service/Context.php b/Classes/Domain/Service/Context.php index 3abe770e5..a4ec960ae 100644 --- a/Classes/Domain/Service/Context.php +++ b/Classes/Domain/Service/Context.php @@ -267,7 +267,7 @@ public function getNodeByIdentifier($identifier) if ($node !== false) { return $node; } - $nodeData = $this->nodeDataRepository->findOneByIdentifier($identifier, $this->getWorkspace(), $this->dimensions); + $nodeData = $this->nodeDataRepository->findOneByIdentifier($identifier, $this->getWorkspace(), $this->dimensions, $this->removedContentShown); if ($nodeData !== null) { $node = $this->nodeFactory->createFromNodeData($nodeData, $this); } else { From 080d9e3ddb613d0cc1fe142e82860ce3a3f4eaa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Mu=CC=88ller?= Date: Fri, 5 Apr 2019 16:33:37 +0200 Subject: [PATCH 2/4] TASK: Contain dimension changes in tests to test case only The reset to empty array was technically wrong because dimensions were configured. While this is not an issue at this time, it can be one when other tests rely on the integrity of configured dimensions and the repository. --- Tests/Functional/Domain/NodeServiceTest.php | 4 +++- Tests/Functional/Domain/NodesTest.php | 4 +++- Tests/Functional/TypeConverter/NodeConverterTest.php | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Tests/Functional/Domain/NodeServiceTest.php b/Tests/Functional/Domain/NodeServiceTest.php index 81aca6c7b..c77b1a083 100644 --- a/Tests/Functional/Domain/NodeServiceTest.php +++ b/Tests/Functional/Domain/NodeServiceTest.php @@ -11,6 +11,7 @@ * source code. */ +use Neos\Flow\Configuration\ConfigurationManager; use Neos\Flow\Tests\FunctionalTestCase; use Neos\ContentRepository\Domain\Model\Workspace; use Neos\ContentRepository\Domain\Repository\ContentDimensionRepository; @@ -88,7 +89,8 @@ public function tearDown() { parent::tearDown(); $this->inject($this->contextFactory, 'contextInstances', array()); - $this->contentDimensionRepository->setDimensionsConfiguration(array()); + $configuredDimensions = $this->objectManager->get(ConfigurationManager::class)->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.ContentRepository.contentDimensions'); + $this->contentDimensionRepository->setDimensionsConfiguration($configuredDimensions); } /** diff --git a/Tests/Functional/Domain/NodesTest.php b/Tests/Functional/Domain/NodesTest.php index 9d423472d..320c1f2a6 100644 --- a/Tests/Functional/Domain/NodesTest.php +++ b/Tests/Functional/Domain/NodesTest.php @@ -11,6 +11,7 @@ * source code. */ +use Neos\Flow\Configuration\ConfigurationManager; use Neos\Flow\Tests\FunctionalTestCase; use Neos\ContentRepository\Domain\Factory\NodeFactory; use Neos\ContentRepository\Domain\Model\Node; @@ -103,7 +104,8 @@ public function tearDown() { parent::tearDown(); $this->inject($this->contextFactory, 'contextInstances', []); - $this->contentDimensionRepository->setDimensionsConfiguration([]); + $configuredDimensions = $this->objectManager->get(ConfigurationManager::class)->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.ContentRepository.contentDimensions'); + $this->contentDimensionRepository->setDimensionsConfiguration($configuredDimensions); } /** diff --git a/Tests/Functional/TypeConverter/NodeConverterTest.php b/Tests/Functional/TypeConverter/NodeConverterTest.php index f21bedcd5..c43b7ef1b 100644 --- a/Tests/Functional/TypeConverter/NodeConverterTest.php +++ b/Tests/Functional/TypeConverter/NodeConverterTest.php @@ -12,6 +12,7 @@ */ use Neos\Error\Messages\Error; +use Neos\Flow\Configuration\ConfigurationManager; use Neos\Flow\Property\PropertyMappingConfiguration; use Neos\Flow\Tests\FunctionalTestCase; use Neos\ContentRepository\Domain\Model\Node; @@ -113,8 +114,9 @@ public function setUp() public function tearDown() { + $configuredDimensions = $this->objectManager->get(ConfigurationManager::class)->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.ContentRepository.contentDimensions'); $contentDimensionRepository = $this->objectManager->get(ContentDimensionRepository::class); - $contentDimensionRepository->setDimensionsConfiguration(array()); + $contentDimensionRepository->setDimensionsConfiguration($configuredDimensions); parent::tearDown(); } From 91356097a912e9cd94046ca345a7025411eaa6e2 Mon Sep 17 00:00:00 2001 From: Gerhard Boden Date: Fri, 19 Apr 2019 14:46:33 +0200 Subject: [PATCH 3/4] BUGFIX: Fix return type annotation --- Classes/Domain/Model/Node.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Domain/Model/Node.php b/Classes/Domain/Model/Node.php index 6d46fad33..477f70187 100644 --- a/Classes/Domain/Model/Node.php +++ b/Classes/Domain/Model/Node.php @@ -502,7 +502,7 @@ public function getIndex() /** * Returns the parent node of this node * - * @return NodeInterface The parent node or NULL if this is the root node + * @return NodeInterface|null The parent node or NULL if this is the root node * @api */ public function getParent() From 29f7d3a187e74c89b7e214b95a8810c0f8b36430 Mon Sep 17 00:00:00 2001 From: Martin Ficzel Date: Tue, 23 Apr 2019 10:05:38 +0200 Subject: [PATCH 4/4] BUGFIX: Filtering by nodeType that has subtypes causes an php error The previous implementation passes the nodeType that was given as filter-argument as string to the returned constraint but all superTypes as NodeType-objects. This later on causes trouble once the types are passed to the isOfType method that expects (but not enforces) strings. The bug exists in all maintained versions of the CR but is exposed in Neos 4.2 by the altered handling of removed nodeTypes. Before that isOfType implicitly accepted a NodeType as argument. The new checks for declaredSuperTypes that are null (removed by subtype) broke this implication. --- Classes/Domain/Repository/NodeDataRepository.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Classes/Domain/Repository/NodeDataRepository.php b/Classes/Domain/Repository/NodeDataRepository.php index bbefd56b4..8b6b95f7f 100644 --- a/Classes/Domain/Repository/NodeDataRepository.php +++ b/Classes/Domain/Repository/NodeDataRepository.php @@ -1093,13 +1093,13 @@ protected function getNodeTypeFilterConstraintsForDql($nodeTypeFilter = '') } else { $negate = false; } - $nodeTypeFilterPartSubTypes = array_merge([$nodeTypeFilterPart], $this->nodeTypeManager->getSubNodeTypes($nodeTypeFilterPart)); + $nodeTypeFilterPartSubTypes = array_merge([$this->nodeTypeManager->getNodeType($nodeTypeFilterPart)], $this->nodeTypeManager->getSubNodeTypes($nodeTypeFilterPart)); foreach ($nodeTypeFilterPartSubTypes as $nodeTypeFilterPartSubType) { if ($negate === true) { - $constraints['excludeNodeTypes'][] = $nodeTypeFilterPartSubType; + $constraints['excludeNodeTypes'][] = $nodeTypeFilterPartSubType->getName(); } else { - $constraints['includeNodeTypes'][] = $nodeTypeFilterPartSubType; + $constraints['includeNodeTypes'][] = $nodeTypeFilterPartSubType->getName(); } } } @@ -1125,13 +1125,13 @@ protected function getNodeTypeFilterConstraints(QueryInterface $query, $nodeType } else { $negate = false; } - $nodeTypeFilterPartSubTypes = array_merge([$nodeTypeFilterPart], $this->nodeTypeManager->getSubNodeTypes($nodeTypeFilterPart, false)); + $nodeTypeFilterPartSubTypes = array_merge([$this->nodeTypeManager->getNodeType($nodeTypeFilterPart)], $this->nodeTypeManager->getSubNodeTypes($nodeTypeFilterPart, false)); foreach ($nodeTypeFilterPartSubTypes as $nodeTypeFilterPartSubType) { if ($negate === true) { - $excludeNodeTypeConstraints[] = $query->logicalNot($query->equals('nodeType', $nodeTypeFilterPartSubType)); + $excludeNodeTypeConstraints[] = $query->logicalNot($query->equals('nodeType', $nodeTypeFilterPartSubType->getName())); } else { - $includeNodeTypeConstraints[] = $query->equals('nodeType', $nodeTypeFilterPartSubType); + $includeNodeTypeConstraints[] = $query->equals('nodeType', $nodeTypeFilterPartSubType->getName()); } } }