Skip to content

Commit

Permalink
BUGFIX: fix moving nodes in specific circumstances like fallback dime…
Browse files Browse the repository at this point in the history
…nsions
  • Loading branch information
JamesAlias committed Dec 6, 2023
1 parent 5b0469a commit c7551cd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Neos.ContentRepository/Classes/Domain/Model/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,8 @@ public function moveBefore(NodeInterface $referenceNode, string $newName = null)
$name = $newName !== null ? $newName : $this->getName();
$referenceParentNode = $referenceNode->getParent();

if ($referenceParentNode !== $this->getParent() && $referenceParentNode->getNode($name) !== null) {
throw new NodeExistsException(sprintf('Node with path "%s" already exists.', $name), 1292503468);
if ($referenceParentNode !== $this->getParent() && $referenceParentNode->getNode($name) === $this) {
throw new NodeExistsException(sprintf('Node with path "%s" already exists.', $this->getPath()), 1292503468);
}

if (($referenceParentNode instanceof Node && !$referenceParentNode->willChildNodeBeAutoCreated($name)) && !$referenceParentNode->isNodeTypeAllowedAsChildNode($this->getNodeType())) {
Expand Down Expand Up @@ -665,8 +665,8 @@ public function moveAfter(NodeInterface $referenceNode, string $newName = null):
$name = $newName !== null ? $newName : $this->getName();
$referenceParentNode = $referenceNode->getParent();

if ($referenceParentNode !== $this->getParent() && $referenceParentNode->getNode($name) !== null) {
throw new NodeExistsException(sprintf('Node with path "%s" already exists.', $name), 1292503469);
if ($referenceParentNode !== $this->getParent() && $referenceParentNode->getNode($name) === $this) {
throw new NodeExistsException(sprintf('Node with path "%s" already exists.', $this->getPath()), 1292503469);
}

if (($referenceParentNode instanceof Node && !$referenceParentNode->willChildNodeBeAutoCreated($name)) && !$referenceParentNode->isNodeTypeAllowedAsChildNode($this->getNodeType())) {
Expand Down Expand Up @@ -711,8 +711,8 @@ public function moveInto(NodeInterface $referenceNode, string $newName = null):

$name = $newName !== null ? $newName : $this->getName();

if ($referenceNode !== $this->getParent() && $referenceNode->getNode($name) !== null) {
throw new NodeExistsException(sprintf('Node with path "%s" already exists.', $name), 1292503470);
if ($referenceNode !== $this->getParent() && $referenceNode->getNode($name) === $this) {
throw new NodeExistsException(sprintf('Node with path "%s" already exists.', $this->getPath()), 1292503470);
}

if (($referenceNode instanceof Node && !$referenceNode->willChildNodeBeAutoCreated($name)) && !$referenceNode->isNodeTypeAllowedAsChildNode($this->getNodeType())) {
Expand Down

0 comments on commit c7551cd

Please sign in to comment.