-
-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUGFIX: Copy node respect tethered nodes correctly #5350 #5358
Closed
mhsdesign
wants to merge
3
commits into
neos:9.0
from
mhsdesign:bufix/copyNodesRecursively-with-tethered-nodes
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
82 changes: 82 additions & 0 deletions
82
...sitory.BehavioralTests/Tests/Behavior/Features/NodeCopying/CopyNode_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,82 @@ | ||
Feature: Copy nodes with tethered nodes | ||
|
||
Background: | ||
Given using no content dimensions | ||
And using the following node types: | ||
"""yaml | ||
'Neos.ContentRepository.Testing:Document': [] | ||
'Neos.ContentRepository.Testing:DocumentWithTethered': | ||
childNodes: | ||
tethered: | ||
type: 'Neos.ContentRepository.Testing:Document' | ||
""" | ||
And using identifier "default", I define a content repository | ||
And I am in content repository "default" | ||
And the command CreateRootWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "live" | | ||
| newContentStreamId | "cs-identifier" | | ||
When I am in workspace "live" and dimension space point {} | ||
And I am user identified by "initiating-user-identifier" | ||
And the command CreateRootNodeAggregateWithNode is executed with payload: | ||
| Key | Value | | ||
| nodeAggregateId | "lady-eleonode-rootford" | | ||
| nodeTypeName | "Neos.ContentRepository:Root" | | ||
|
||
When the following CreateNodeAggregateWithNode commands are executed: | ||
| nodeAggregateId | parentNodeAggregateId | nodeTypeName | tetheredDescendantNodeAggregateIds | | ||
| sir-david-nodenborough | lady-eleonode-rootford | Neos.ContentRepository.Testing:Document | {} | | ||
| nody-mc-nodeface | sir-david-nodenborough | Neos.ContentRepository.Testing:Document | | | ||
| sir-nodeward-nodington-i | lady-eleonode-rootford | Neos.ContentRepository.Testing:DocumentWithTethered | {"tethered": "nodewyn-tetherton"} | | ||
|
||
Scenario: Coping a tethered node turns it into a regular node | ||
And I expect the node aggregate "nodewyn-tetherton" to exist | ||
And I expect this node aggregate to be classified as "tethered" | ||
|
||
When the command CopyNodesRecursively is executed with payload: | ||
| Key | Value | | ||
| sourceDimensionSpacePoint | {} | | ||
| sourceNodeAggregateId | "nodewyn-tetherton" | | ||
| targetDimensionSpacePoint | {} | | ||
| targetParentNodeAggregateId | "sir-david-nodenborough" | | ||
| nodeAggregateIdMapping | {"nodewyn-tetherton": "nodewyn-tetherton-copy"} | | ||
|
||
And I expect the node aggregate "nodewyn-tetherton-copy" to exist | ||
# must not be tethered! | ||
And I expect this node aggregate to be classified as "regular" | ||
And I expect this node aggregate to be of type "Neos.ContentRepository.Testing:Document" | ||
And I expect this node aggregate to be unnamed | ||
And I expect this node aggregate to occupy dimension space points [[]] | ||
And I expect this node aggregate to disable dimension space points [] | ||
And I expect this node aggregate to have no child node aggregates | ||
And I expect this node aggregate to have the parent node aggregates ["sir-david-nodenborough"] | ||
|
||
Scenario: Coping a node with tethered node keeps the child node tethered | ||
And I expect the node aggregate "nodewyn-tetherton" to exist | ||
And I expect this node aggregate to be classified as "tethered" | ||
|
||
When the command CopyNodesRecursively is executed with payload: | ||
| Key | Value | | ||
| sourceDimensionSpacePoint | {} | | ||
| sourceNodeAggregateId | "sir-nodeward-nodington-i" | | ||
| targetDimensionSpacePoint | {} | | ||
| targetParentNodeAggregateId | "sir-david-nodenborough" | | ||
| nodeAggregateIdMapping | {"sir-nodeward-nodington-i": "sir-nodeward-nodington-ii", "nodewyn-tetherton": "nodewyn-tetherton-copy"} | | ||
|
||
And I expect the node aggregate "sir-nodeward-nodington-ii" to exist | ||
And I expect this node aggregate to be classified as "regular" | ||
And I expect this node aggregate to be unnamed | ||
And I expect this node aggregate to be of type "Neos.ContentRepository.Testing:DocumentWithTethered" | ||
And I expect this node aggregate to occupy dimension space points [[]] | ||
And I expect this node aggregate to disable dimension space points [] | ||
And I expect this node aggregate to have the child node aggregates ["nodewyn-tetherton-copy"] | ||
And I expect this node aggregate to have the parent node aggregates ["sir-david-nodenborough"] | ||
|
||
And I expect the node aggregate "nodewyn-tetherton-copy" to exist | ||
And I expect this node aggregate to be classified as "tethered" | ||
And I expect this node aggregate to be named "tethered" | ||
And I expect this node aggregate to be of type "Neos.ContentRepository.Testing:Document" | ||
And I expect this node aggregate to occupy dimension space points [[]] | ||
And I expect this node aggregate to disable dimension space points [] | ||
And I expect this node aggregate to have no child node aggregates | ||
And I expect this node aggregate to have the parent node aggregates ["sir-nodeward-nodington-ii"] |
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 | ||
{ | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jup this looks ugly but it doesnt matter, this is just meant as a hotfix. In order to evaluate constraints correctly (64) and also copying of dimensions we have to move this logic to a command handler imo and create a serialised version of this stuff.
But first things first, hey at least copying is now a little les broken :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: I created an issue for that: #5359