1
1
<?php
2
+
2
3
namespace Neos \Neos \Ui \ContentRepository \Service ;
3
4
4
5
/*
14
15
use Neos \ContentRepository \Core \Projection \ContentGraph \Filter \FindClosestNodeFilter ;
15
16
use Neos \ContentRepository \Core \Projection \ContentGraph \Node ;
16
17
use Neos \ContentRepository \Core \Projection \ContentGraph \VisibilityConstraints ;
17
- use Neos \ContentRepository \Core \SharedModel \Node \NodeAddress ;
18
18
use Neos \ContentRepository \Core \SharedModel \ContentRepository \ContentRepositoryId ;
19
+ use Neos \ContentRepository \Core \SharedModel \Node \NodeAddress ;
19
20
use Neos \ContentRepository \Core \SharedModel \Workspace \WorkspaceName ;
20
21
use Neos \ContentRepositoryRegistry \ContentRepositoryRegistry ;
21
22
use Neos \Flow \Annotations as Flow ;
@@ -51,11 +52,12 @@ class WorkspaceService
51
52
public function getPublishableNodeInfo (WorkspaceName $ workspaceName , ContentRepositoryId $ contentRepositoryId ): array
52
53
{
53
54
$ contentRepository = $ this ->contentRepositoryRegistry ->get ($ contentRepositoryId );
55
+ $ contentGraph = $ contentRepository ->getContentGraph ($ workspaceName );
54
56
$ pendingChanges = $ this ->workspacePublishingService ->pendingWorkspaceChanges ($ contentRepositoryId , $ workspaceName );
55
57
/** @var array{contextPath:string,documentContextPath:string,typeOfChange:int}[] $unpublishedNodes */
56
58
$ unpublishedNodes = [];
57
59
foreach ($ pendingChanges as $ change ) {
58
- if ($ change ->removalAttachmentPoint ) {
60
+ if ($ change ->removalAttachmentPoint && $ change -> originDimensionSpacePoint !== null ) {
59
61
$ nodeAddress = NodeAddress::create (
60
62
$ contentRepositoryId ,
61
63
$ workspaceName ,
@@ -79,20 +81,31 @@ public function getPublishableNodeInfo(WorkspaceName $workspaceName, ContentRepo
79
81
'typeOfChange ' => $ this ->getTypeOfChange ($ change )
80
82
];
81
83
} else {
82
- $ subgraph = $ contentRepository ->getContentGraph ($ workspaceName )->getSubgraph (
83
- $ change ->originDimensionSpacePoint ->toDimensionSpacePoint (),
84
- VisibilityConstraints::withoutRestrictions ()
85
- );
86
- $ node = $ subgraph ->findNodeById ($ change ->nodeAggregateId );
87
-
88
- if ($ node instanceof Node) {
89
- $ documentNode = $ subgraph ->findClosestNode ($ node ->aggregateId , FindClosestNodeFilter::create (nodeTypes: NodeTypeNameFactory::NAME_DOCUMENT ));
90
- if ($ documentNode instanceof Node) {
91
- $ unpublishedNodes [] = [
92
- 'contextPath ' => NodeAddress::fromNode ($ node )->toJson (),
93
- 'documentContextPath ' => NodeAddress::fromNode ($ documentNode )->toJson (),
94
- 'typeOfChange ' => $ this ->getTypeOfChange ($ change )
95
- ];
84
+ if ($ change ->originDimensionSpacePoint !== null ) {
85
+ $ originDimensionSpacePoints = [$ change ->originDimensionSpacePoint ];
86
+ } else {
87
+ // If originDimensionSpacePoint is null, we have a change to the nodeAggregate. All nodes in the
88
+ // occupied dimensionspacepoints shall be marked as changed.
89
+ $ originDimensionSpacePoints = $ contentGraph
90
+ ->findNodeAggregateById ($ change ->nodeAggregateId )
91
+ ?->occupiedDimensionSpacePoints ?: [];
92
+ }
93
+
94
+ foreach ($ originDimensionSpacePoints as $ originDimensionSpacePoint ) {
95
+ $ subgraph = $ contentGraph ->getSubgraph (
96
+ $ originDimensionSpacePoint ->toDimensionSpacePoint (),
97
+ VisibilityConstraints::withoutRestrictions ()
98
+ );
99
+ $ node = $ subgraph ->findNodeById ($ change ->nodeAggregateId );
100
+ if ($ node instanceof Node) {
101
+ $ documentNode = $ subgraph ->findClosestNode ($ node ->aggregateId , FindClosestNodeFilter::create (nodeTypes: NodeTypeNameFactory::NAME_DOCUMENT ));
102
+ if ($ documentNode instanceof Node) {
103
+ $ unpublishedNodes [] = [
104
+ 'contextPath ' => NodeAddress::fromNode ($ node )->toJson (),
105
+ 'documentContextPath ' => NodeAddress::fromNode ($ documentNode )->toJson (),
106
+ 'typeOfChange ' => $ this ->getTypeOfChange ($ change )
107
+ ];
108
+ }
96
109
}
97
110
}
98
111
}
0 commit comments