Skip to content

Commit 364b160

Browse files
daniellienertkdambekalns
authored andcommitted
BUGFIX: Ensure that fake nodes are not persisted to the database
1 parent 792e7e7 commit 364b160

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Classes/Domain/Service/FakeNodeDataFactory.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Neos\ContentRepository\Domain\Service\NodeTypeManager;
1818
use Neos\ContentRepository\Exception\NodeTypeNotFoundException;
1919
use Neos\Flow\Annotations as Flow;
20+
use Neos\Flow\Persistence\Doctrine\PersistenceManager;
2021

2122
/**
2223
* @Flow\Scope("singleton")
@@ -35,6 +36,12 @@ class FakeNodeDataFactory
3536
*/
3637
protected $nodeTypeManager;
3738

39+
/**
40+
* @var PersistenceManager
41+
* @Flow\Inject
42+
*/
43+
protected $persistenceManager;
44+
3845
/**
3946
* This creates a "fake" removed NodeData instance from the given payload
4047
*
@@ -74,6 +81,11 @@ public function createFromPayload(array $payload)
7481

7582
$nodeData->setRemoved(true);
7683

84+
// Ensure, the fake-node is not persisted
85+
if ($this->persistenceManager->isNewObject($nodeData)) {
86+
$this->persistenceManager->remove($nodeData);
87+
}
88+
7789
return $nodeData;
7890
}
7991
}

0 commit comments

Comments
 (0)