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 1919use Neos \ContentRepository \Domain \Service \NodeTypeManager ;
2020use Neos \ContentRepository \Exception \NodeTypeNotFoundException ;
2121use Neos \Flow \Annotations as Flow ;
22+ use Neos \Flow \Persistence \Doctrine \PersistenceManager ;
2223
2324/**
2425 * @Flow\Scope("singleton")
@@ -37,14 +38,20 @@ class FakeNodeDataFactory
3738 */
3839 protected $ nodeTypeManager ;
3940
41+ /**
42+ * @var PersistenceManager
43+ * @Flow\Inject
44+ */
45+ protected $ persistenceManager ;
46+
4047 /**
4148 * This creates a "fake" removed NodeData instance from the given payload
4249 *
4350 * @param array $payload
4451 * @return NodeData
4552 * @throws Exception
4653 */
47- public function createFromPayload (array $ payload )
54+ public function createFromPayload (array $ payload ): NodeData
4855 {
4956 if (!isset ($ payload ['workspace ' ]) || empty ($ payload ['workspace ' ])) {
5057 throw new Exception ('Unable to create fake node data, missing workspace value ' , 1508448007 );
@@ -76,6 +83,11 @@ public function createFromPayload(array $payload)
7683
7784 $ nodeData ->setRemoved (true );
7885
86+ // Ensure, the fake-node is not persisted
87+ if ($ this ->persistenceManager ->isNewObject ($ nodeData )) {
88+ $ this ->persistenceManager ->remove ($ nodeData );
89+ }
90+
7991 return $ nodeData ;
8092 }
8193}
You can’t perform that action at this time.
0 commit comments