-
-
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
FEATURE: Node copying Version 3 (as a Neos service) #5371
Merged
Merged
Changes from 27 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
0436ecf
WIP: Node Copy Version 3, first draft of NodeDuplicationService
mhsdesign 2393125
WIP: Fix copy tethered node if leave node or nested
mhsdesign cc4ef55
Merge remote-tracking branch 'origin/9.0' into bugfix/copy-nodes-as-a…
mhsdesign 870c35b
BUGFIX: Only leaf tethered nodes can be copied
mhsdesign d8cde95
TASK: Reintroduce reference copying for first node
mhsdesign ea753ca
TASK: Add further testcases for node copy
mhsdesign ded2e9d
TASK: Test and fix recursive node copying
mhsdesign 7d39367
TASK: Add test for copying tethered nodes deep in the tree
mhsdesign 05fb869
TASK: Add failing test for copying nested references
mhsdesign d7c70c3
TASK: Add failing test for copying nested tethered nodes
mhsdesign f61ab5e
BUGFIX: Fix copying nested tethered nodes
mhsdesign 4abe078
BUGFIX: Copy references for child nodes on copy
mhsdesign c4447d3
TASK: Remove unused constraint check helpers from `TransientNodeCopy`
mhsdesign 7e5fbf4
TASK: Move `NodeAggregateIdMapping` to Neos as it will be removed fro…
mhsdesign 81aa60f
TASK: Make phpstan happy
mhsdesign 37e9a51
TASK: Fix specifying `references` in a row
mhsdesign babc6cf
TASK: Add proper constraint-check exceptions
mhsdesign a4b1689
TASK: Remove todo regarding additional property values for first node
mhsdesign 2fb6ab7
TASK: (re)Introduce `Subtrees` as typed array for `$children`
mhsdesign 42c6b6a
!!! TASK: Soft removal of `CopyNodesRecursively`
mhsdesign d5d9dbe
TASK: Make `NodeAggregateIdMapping` usable and API, as its used in th…
mhsdesign 3d5e963
TASK: Remove `$targetNodeName` from first level api option in `copyNo…
mhsdesign 0096689
TASK: Move generic `Commands` into cr core
mhsdesign cb6b523
TASK: Document `NodeDuplicationService`
mhsdesign 8d14bae
FEATURE: Copy subtree tags during copy
mhsdesign fdea0c6
BUGFIX: Migration to fix previously copied tethered nodes #5350
mhsdesign 44c18dc
TASK: Introduce `migrateevents:copyNodesStatus`
mhsdesign 8ae5755
TASK: Introduce `Subtrees::createEmpty`
mhsdesign 38f336d
TASK: Adjust to new behat gherkin version to use quadruple back-slash
mhsdesign 3de7d04
TASK: Add test for simple constraint checks
mhsdesign 8523010
TASK: Introduce internal `calculateCopyNodesRecursively`
mhsdesign 79794db
TASK: Rename `NodePath::forRoot` to `NodePath::createEmpty()`
mhsdesign d3115ce
TASK: Remove obsolete logic to keep tethered node ids
mhsdesign 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
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
90 changes: 0 additions & 90 deletions
90
...ository.BehavioralTests/Tests/Behavior/Features/NodeCopying/CopyNode_NoDimensions.feature
This file was deleted.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
Neos.ContentRepository.Core/Classes/CommandHandler/Commands.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,62 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\ContentRepository\Core\CommandHandler; | ||
|
||
/** | ||
* @api can be used as collection of commands to be individually handled: | ||
* | ||
* foreach ($commands as $command) { | ||
* $contentRepository->handle($command); | ||
* } | ||
* | ||
* @implements \IteratorAggregate<CommandInterface> | ||
*/ | ||
final readonly class Commands implements \IteratorAggregate, \Countable | ||
{ | ||
/** @var array<int,CommandInterface> */ | ||
private array $items; | ||
|
||
private function __construct( | ||
CommandInterface ...$items | ||
) { | ||
$this->items = array_values($items); | ||
} | ||
|
||
public static function create(CommandInterface ...$items): self | ||
{ | ||
return new self(...$items); | ||
} | ||
|
||
public static function createEmpty(): self | ||
{ | ||
return new self(); | ||
} | ||
|
||
/** @param array<CommandInterface> $array */ | ||
public static function fromArray(array $array): self | ||
{ | ||
return new self(...$array); | ||
} | ||
|
||
public function append(CommandInterface $command): self | ||
{ | ||
return new self(...[...$this->items, $command]); | ||
} | ||
|
||
public function merge(self $other): self | ||
{ | ||
return new self(...$this->items, ...$other->items); | ||
} | ||
|
||
public function getIterator(): \Traversable | ||
{ | ||
yield from $this->items; | ||
} | ||
|
||
public function count(): int | ||
{ | ||
return count($this->items); | ||
} | ||
} |
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
48 changes: 48 additions & 0 deletions
48
Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Subtrees.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,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\ContentRepository\Core\Projection\ContentGraph; | ||
|
||
/** | ||
* @api part of {@see Subtree} | ||
* @implements \IteratorAggregate<Subtree> | ||
*/ | ||
final readonly class Subtrees implements \IteratorAggregate, \Countable | ||
{ | ||
/** @var array<Subtree> */ | ||
private array $items; | ||
|
||
private function __construct( | ||
Subtree ...$items | ||
) { | ||
$this->items = $items; | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
public static function create(Subtree ...$items): self | ||
{ | ||
return new self(...$items); | ||
} | ||
|
||
/** | ||
* @internal | ||
* @param array<Subtree> $items | ||
*/ | ||
public static function fromArray(array $items): self | ||
{ | ||
return new self(...$items); | ||
} | ||
|
||
public function getIterator(): \Traversable | ||
{ | ||
yield from $this->items; | ||
} | ||
|
||
public function count(): int | ||
{ | ||
return count($this->items); | ||
} | ||
} |
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
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.
took me a moment here, I think I might prefer a Subtrees::empty() and then
array_key_exists($nodeAggregateId, $subtreesByParentNodeId) ? Subtrees::fromArray(array_reverse($subtreesByParentNodeId[$nodeAggregateId])) : Subtrees:empty()