File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 19
19
use Neos \ContentRepository \Domain \Service \NodeTypeManager ;
20
20
use Neos \ContentRepository \Exception \NodeTypeNotFoundException ;
21
21
use Neos \Flow \Annotations as Flow ;
22
+ use Neos \Flow \Persistence \Doctrine \PersistenceManager ;
22
23
23
24
/**
24
25
* @Flow\Scope("singleton")
@@ -37,14 +38,20 @@ class FakeNodeDataFactory
37
38
*/
38
39
protected $ nodeTypeManager ;
39
40
41
+ /**
42
+ * @var PersistenceManager
43
+ * @Flow\Inject
44
+ */
45
+ protected $ persistenceManager ;
46
+
40
47
/**
41
48
* This creates a "fake" removed NodeData instance from the given payload
42
49
*
43
50
* @param array $payload
44
51
* @return NodeData
45
52
* @throws Exception
46
53
*/
47
- public function createFromPayload (array $ payload )
54
+ public function createFromPayload (array $ payload ): NodeData
48
55
{
49
56
if (!isset ($ payload ['workspace ' ]) || empty ($ payload ['workspace ' ])) {
50
57
throw new Exception ('Unable to create fake node data, missing workspace value ' , 1508448007 );
@@ -76,6 +83,11 @@ public function createFromPayload(array $payload)
76
83
77
84
$ nodeData ->setRemoved (true );
78
85
86
+ // Ensure, the fake-node is not persisted
87
+ if ($ this ->persistenceManager ->isNewObject ($ nodeData )) {
88
+ $ this ->persistenceManager ->remove ($ nodeData );
89
+ }
90
+
79
91
return $ nodeData ;
80
92
}
81
93
}
You can’t perform that action at this time.
0 commit comments