Skip to content

Commit

Permalink
TASK: Adjust to references changes in Neos
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Oct 30, 2024
1 parent b6673a7 commit 874e187
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
8 changes: 7 additions & 1 deletion Classes/Domain/Model/Changes/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
)
)
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand All @@ -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);
}
};
}
Expand Down

0 comments on commit 874e187

Please sign in to comment.