-
-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUGFIX: Copy node respect tethered nodes correctly #5350
In case a leaf node that is tethered is copied, we un-tether it. A migration `flow migrateevents:migratecopytetherednode` fixes this for previous cases. In case a tethered node is attempted to be copied which has tethered childnodes determined by the parent nodetype we fail. This is not possible. What we dont do yet is determine this correctly and there are false positives: > we assume here that the child node is tethered because the grandparent specifies that. > this is not always fully correct and we could loosen the constraint by checking the node type schema to correctly determine this, we have to evaluate the node type schema which is not available currently.
- Loading branch information
Showing
7 changed files
with
211 additions
and
11 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
...Tests/Tests/Behavior/Features/NodeCopying/CopyNode_ConstraintChecks_TetheredNodes.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
@contentrepository @adapters=DoctrineDBAL | ||
Feature: Copy nodes (without dimensions) | ||
|
||
Background: | ||
Given using no content dimensions | ||
And using the following node types: | ||
"""yaml | ||
'Neos.ContentRepository.Testing:Tethered': [] | ||
'Neos.ContentRepository.Testing:TetheredDocument': | ||
childNodes: | ||
tethered: | ||
type: 'Neos.ContentRepository.Testing:Tethered' | ||
'Neos.ContentRepository.Testing:Document': | ||
childNodes: | ||
tethered-document: | ||
type: 'Neos.ContentRepository.Testing:TetheredDocument' | ||
'Neos.ContentRepository.Testing:DocumentWithoutTetheredChildren': [] | ||
""" | ||
And using identifier "default", I define a content repository | ||
And I am in content repository "default" | ||
And I am user identified by "initiating-user-identifier" | ||
And the command CreateRootWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "live" | | ||
| newContentStreamId | "cs-identifier" | | ||
And I am in workspace "live" and dimension space point {} | ||
And the command CreateRootNodeAggregateWithNode is executed with payload: | ||
| Key | Value | | ||
| nodeAggregateId | "lady-eleonode-rootford" | | ||
| nodeTypeName | "Neos.ContentRepository:Root" | | ||
And the following CreateNodeAggregateWithNode commands are executed: | ||
| nodeAggregateId | parentNodeAggregateId | nodeTypeName | tetheredDescendantNodeAggregateIds | | ||
| node-mc-nodeface | lady-eleonode-rootford | Neos.ContentRepository.Testing:DocumentWithoutTetheredChildren | {} | | ||
| node-wan-kenody | lady-eleonode-rootford | Neos.ContentRepository.Testing:Document | {"tethered-document": "nodewyn-tetherton", "tethered-document/tethered": "nodimer-tetherton"} | | ||
|
||
Scenario: Coping fails if the leaf of a nested tethered node is attempted to be copied | ||
And I expect the node aggregate "nodewyn-tetherton" to exist | ||
And I expect this node aggregate to be classified as "tethered" | ||
|
||
And I expect the node aggregate "nodimer-tetherton" to exist | ||
And I expect this node aggregate to be classified as "tethered" | ||
|
||
When the command CopyNodesRecursively is executed with payload and exceptions are caught: | ||
| Key | Value | | ||
| sourceDimensionSpacePoint | {} | | ||
| sourceNodeAggregateId | "nodewyn-tetherton" | | ||
| targetDimensionSpacePoint | {} | | ||
| targetParentNodeAggregateId | "node-mc-nodeface" | | ||
| nodeAggregateIdMapping | {"nodewyn-tetherton": "nodewyn-tetherton-copy", "nodimer-tetherton": "nodimer-tetherton-copy"} | | ||
|
||
Then the last command should have thrown an exception of type "TetheredNodesCannotBePartiallyCopied" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...entRepository.Core/Classes/SharedModel/Exception/TetheredNodesCannotBePartiallyCopied.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Neos.ContentRepository package. | ||
* | ||
* (c) Contributors of the Neos Project - www.neos.io | ||
* | ||
* This package is Open Source Software. For the full copyright and license | ||
* information, please view the LICENSE file which was distributed with this | ||
* source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\ContentRepository\Core\SharedModel\Exception; | ||
|
||
/** | ||
* The exception to be thrown if a tethered node aggregate with further whether nodes, determined by their ancestor is attempted to be copied. | ||
* | ||
* Only leaf tethered nodes can be copied. | ||
* | ||
* @api because exception is thrown during invariant checks on command execution | ||
*/ | ||
final class TetheredNodesCannotBePartiallyCopied extends \DomainException | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters