diff --git a/Classes/Domain/Model/Changes/Property.php b/Classes/Domain/Model/Changes/Property.php index 93ece455dc..766754d0af 100644 --- a/Classes/Domain/Model/Changes/Property.php +++ b/Classes/Domain/Model/Changes/Property.php @@ -19,6 +19,7 @@ use Neos\ContentRepository\Core\Feature\NodeModification\Command\SetNodeProperties; use Neos\ContentRepository\Core\Feature\NodeModification\Dto\PropertyValuesToWrite; use Neos\ContentRepository\Core\Feature\NodeReferencing\Command\SetNodeReferences; +use Neos\ContentRepository\Core\Feature\NodeReferencing\Dto\NodeReferencesForName; use Neos\ContentRepository\Core\Feature\NodeReferencing\Dto\NodeReferencesToWrite; use Neos\ContentRepository\Core\Feature\NodeTypeChange\Command\ChangeNodeAggregateType; use Neos\ContentRepository\Core\Feature\NodeTypeChange\Dto\NodeAggregateTypeChangeChildConstraintConflictResolutionStrategy; @@ -239,7 +240,12 @@ private function handleNodeReferenceChange(Node $subject, string $propertyName): $subject->workspaceName, $subject->aggregateId, $subject->originDimensionSpacePoint, - NodeReferencesToWrite::fromNameAndTargets(ReferenceName::fromString($propertyName), NodeAggregateIds::fromArray($destinationNodeAggregateIds)) + NodeReferencesToWrite::fromReferences( + NodeReferencesForName::fromNameAndTargets( + ReferenceName::fromString($propertyName), + NodeAggregateIds::fromArray($destinationNodeAggregateIds) + ) + ) ) ); } diff --git a/Classes/Infrastructure/ContentRepository/CreationDialog/PromotedElementsCreationHandlerFactory.php b/Classes/Infrastructure/ContentRepository/CreationDialog/PromotedElementsCreationHandlerFactory.php index 996f4f3619..ba06077aa5 100644 --- a/Classes/Infrastructure/ContentRepository/CreationDialog/PromotedElementsCreationHandlerFactory.php +++ b/Classes/Infrastructure/ContentRepository/CreationDialog/PromotedElementsCreationHandlerFactory.php @@ -5,7 +5,7 @@ namespace Neos\Neos\Ui\Infrastructure\ContentRepository\CreationDialog; use Neos\ContentRepository\Core\ContentRepository; -use Neos\ContentRepository\Core\Feature\NodeReferencing\Dto\NodeReferencesToWrite; +use Neos\ContentRepository\Core\Feature\NodeReferencing\Dto\NodeReferencesForName; use Neos\ContentRepository\Core\NodeType\NodeTypeManager; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateIds; use Neos\ContentRepository\Core\SharedModel\Node\ReferenceName; @@ -38,7 +38,7 @@ public function handle(NodeCreationCommands $commands, NodeCreationElements $ele return $commands; } $propertyValues = $commands->first->initialPropertyValues; - $initialReferences = null; + $initialReferences = $commands->first->references; foreach ($elements as $elementName => $elementValue) { // handle properties if ($nodeType->hasProperty($elementName)) { @@ -56,18 +56,19 @@ public function handle(NodeCreationCommands $commands, NodeCreationElements $ele assert($elementValue instanceof NodeAggregateIds); $referenceConfiguration = $nodeType->getReferences()[$elementName]; if (($referenceConfiguration['ui']['showInCreationDialog'] ?? false) === true) { - $referencesToWriteForCurrentElement = NodeReferencesToWrite::fromNameAndTargets(ReferenceName::fromString($elementName), $elementValue); - $initialReferences = $initialReferences === null ? $referencesToWriteForCurrentElement : $initialReferences->merge($referencesToWriteForCurrentElement); + $initialReferences = $initialReferences->withReference( + NodeReferencesForName::fromNameAndTargets( + ReferenceName::fromString($elementName), + $elementValue + ) + ); } } } - if ($initialReferences !== null) { - $commands = $commands->withInitialReferences($initialReferences); - } - return $commands - ->withInitialPropertyValues($propertyValues); + ->withInitialPropertyValues($propertyValues) + ->withInitialReferences($initialReferences); } }; }