diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/ProjectionIntegrityViolationDetectionTrait.php b/Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/ProjectionIntegrityViolationDetectionTrait.php index 4b2a0247472..8f142a757ce 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/ProjectionIntegrityViolationDetectionTrait.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/ProjectionIntegrityViolationDetectionTrait.php @@ -226,7 +226,7 @@ private function transformDatasetToHierarchyRelationRecord(array $dataset): arra return [ 'contentstreamid' => $dataset['contentStreamId'], - 'dimensionspacepoint' => \json_encode($dimensionSpacePoint), + 'dimensionspacepoint' => $dimensionSpacePoint->toJson(), 'dimensionspacepointhash' => $dimensionSpacePoint->hash, 'parentnodeanchor' => $parentNodeAggregateId->isNonExistent() ? Algorithms::generateUUID() @@ -271,9 +271,9 @@ private function findRelationAnchorPointByIds( AND h.contentstreamid = :contentStreamId AND h.dimensionspacepointhash = :dimensionSpacePointHash', [ - 'contentStreamId' => (string)$contentStreamId, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash, - 'nodeAggregateId' => (string)$nodeAggregateId + 'nodeAggregateId' => $nodeAggregateId->value ] )->fetchAssociative(); diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjection.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjection.php index 65a965523b1..a4166df2054 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjection.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjection.php @@ -33,6 +33,7 @@ use Neos\ContentRepository\Core\Feature\NodeDisabling\Event\NodeAggregateWasEnabled; use Neos\ContentRepository\Core\Feature\NodeModification\Event\NodePropertiesWereSet; use Neos\ContentRepository\Core\Feature\NodeMove\Event\NodeAggregateWasMoved; +use Neos\ContentRepository\Core\Feature\NodeReferencing\Dto\SerializedNodeReference; use Neos\ContentRepository\Core\Feature\NodeReferencing\Event\NodeReferencesWereSet; use Neos\ContentRepository\Core\Feature\NodeRemoval\Event\NodeAggregateWasRemoved; use Neos\ContentRepository\Core\Feature\NodeRenaming\Event\NodeAggregateNameWasChanged; @@ -336,9 +337,9 @@ private function whenRootNodeAggregateDimensionsWereUpdated(RootNodeAggregateDim AND childnodeanchor = :childNodeAnchor AND contentstreamid = :contentStreamId ', [ - 'parentNodeAnchor' => (string)NodeRelationAnchorPoint::forRootEdge(), - 'childNodeAnchor' => (string)$rootNodeAnchorPoint, - 'contentStreamId' => (string)$event->contentStreamId + 'parentNodeAnchor' => NodeRelationAnchorPoint::forRootEdge()->value, + 'childNodeAnchor' => $rootNodeAnchorPoint->value, + 'contentStreamId' => $event->contentStreamId->value, ]); // recreate hierarchy edges for the root node $this->connectHierarchy( @@ -399,9 +400,9 @@ private function whenNodeAggregateNameWasChanged(NodeAggregateNameWasChanged $ev n.nodeaggregateid = :nodeAggregateId and h.contentstreamid = :contentStreamId ', [ - 'newName' => (string)$event->newNodeName, - 'nodeAggregateId' => (string)$event->nodeAggregateId, - 'contentStreamId' => (string)$event->contentStreamId, + 'newName' => $event->newNodeName->value, + 'nodeAggregateId' => $event->nodeAggregateId->value, + 'contentStreamId' => $event->contentStreamId->value, 'lastModified' => $eventEnvelope->recordedAt, 'originalLastModified' => self::initiatingDateTime($eventEnvelope), ], [ @@ -435,7 +436,7 @@ private function connectRestrictionRelationsFromParentNodeToNewlyCreatedNode( r.contentstreamid, r.dimensionspacepointhash, r.originnodeaggregateid, - "' . $newlyCreatedNodeAggregateId . '" as affectednodeaggregateid + "' . $newlyCreatedNodeAggregateId->value . '" as affectednodeaggregateid FROM ' . $this->tableNamePrefix . '_restrictionrelation r WHERE @@ -443,10 +444,10 @@ private function connectRestrictionRelationsFromParentNodeToNewlyCreatedNode( and r.dimensionspacepointhash IN (:visibleDimensionSpacePoints) and r.affectednodeaggregateid = :parentNodeAggregateId ', [ - 'sourceContentStreamId' => (string)$contentStreamId, + 'sourceContentStreamId' => $contentStreamId->value, 'visibleDimensionSpacePoints' => $dimensionSpacePointsInWhichNewlyCreatedNodeAggregateIsVisible ->getPointHashes(), - 'parentNodeAggregateId' => (string)$parentNodeAggregateId + 'parentNodeAggregateId' => $parentNodeAggregateId->value ], [ 'visibleDimensionSpacePoints' => Connection::PARAM_STR_ARRAY ]); @@ -641,7 +642,7 @@ private function getRelationPositionAfterRecalculation( $offset += self::RELATION_DEFAULT_OFFSET; if ( $succeedingSiblingAnchorPoint - && (string)$relation->childNodeAnchor === (string)$succeedingSiblingAnchorPoint + && $relation->childNodeAnchor->equals($succeedingSiblingAnchorPoint) ) { $position = $offset; $offset += self::RELATION_DEFAULT_OFFSET; @@ -679,12 +680,12 @@ private function whenContentStreamWasForked(ContentStreamWasForked $event): void h.position, h.dimensionspacepoint, h.dimensionspacepointhash, - "' . $event->newContentStreamId . '" AS contentstreamid + "' . $event->newContentStreamId->value . '" AS contentstreamid FROM ' . $this->tableNamePrefix . '_hierarchyrelation h WHERE h.contentstreamid = :sourceContentStreamId ', [ - 'sourceContentStreamId' => (string)$event->sourceContentStreamId + 'sourceContentStreamId' => $event->sourceContentStreamId->value ]); // @@ -698,7 +699,7 @@ private function whenContentStreamWasForked(ContentStreamWasForked $event): void affectednodeaggregateid ) SELECT - "' . $event->newContentStreamId . '" AS contentstreamid, + "' . $event->newContentStreamId->value . '" AS contentstreamid, r.dimensionspacepointhash, r.originnodeaggregateid, r.affectednodeaggregateid @@ -706,7 +707,7 @@ private function whenContentStreamWasForked(ContentStreamWasForked $event): void ' . $this->tableNamePrefix . '_restrictionrelation r WHERE r.contentstreamid = :sourceContentStreamId ', [ - 'sourceContentStreamId' => (string)$event->sourceContentStreamId + 'sourceContentStreamId' => $event->sourceContentStreamId->value ]); // NOTE: as reference edges are attached to Relation Anchor Points (and they are lazily copy-on-written), @@ -724,7 +725,7 @@ private function whenContentStreamWasRemoved(ContentStreamWasRemoved $event): vo WHERE contentstreamid = :contentStreamId ', [ - 'contentStreamId' => (string)$event->contentStreamId + 'contentStreamId' => $event->contentStreamId->value ]); // Drop non-referenced nodes (which do not have a hierarchy relation anymore) @@ -755,7 +756,7 @@ private function whenContentStreamWasRemoved(ContentStreamWasRemoved $event): vo WHERE contentstreamid = :contentStreamId ', [ - 'contentStreamId' => (string)$event->contentStreamId + 'contentStreamId' => $event->contentStreamId->value ]); }); } @@ -775,8 +776,8 @@ private function whenNodePropertiesWereSet(NodePropertiesWereSet $event, EventEn if (is_null($anchorPoint)) { throw new \InvalidArgumentException( 'Cannot update node with copy on write since no anchor point could be resolved for node ' - . $event->getNodeAggregateId() . ' in content stream ' - . $event->getContentStreamId(), + . $event->getNodeAggregateId()->value . ' in content stream ' + . $event->getContentStreamId()->value, 1645303332 ); } @@ -812,8 +813,8 @@ private function whenNodeReferencesWereSet(NodeReferencesWereSet $event, EventEn throw new \InvalidArgumentException( 'Could not apply event of type "' . get_class($event) . '" since no anchor point could be resolved for node ' - . $event->getNodeAggregateId() . ' in content stream ' - . $event->getContentStreamId(), + . $event->getNodeAggregateId()->value . ' in content stream ' + . $event->getContentStreamId()->value, 1658580583 ); } @@ -838,18 +839,19 @@ function (NodeRecord $node) use ($eventEnvelope) { // remove old $this->getDatabaseConnection()->delete($this->tableNamePrefix . '_referencerelation', [ - 'nodeanchorpoint' => $nodeAnchorPoint, - 'name' => $event->referenceName + 'nodeanchorpoint' => $nodeAnchorPoint?->value, + 'name' => $event->referenceName->value ]); // set new $position = 0; + /** @var SerializedNodeReference $reference */ foreach ($event->references as $reference) { $this->getDatabaseConnection()->insert($this->tableNamePrefix . '_referencerelation', [ - 'name' => $event->referenceName, + 'name' => $event->referenceName->value, 'position' => $position, - 'nodeanchorpoint' => $nodeAnchorPoint, - 'destinationnodeaggregateid' => $reference->targetNodeAggregateId, + 'nodeanchorpoint' => $nodeAnchorPoint?->value, + 'destinationnodeaggregateid' => $reference->targetNodeAggregateId->value, 'properties' => $reference->properties ? \json_encode($reference->properties, JSON_THROW_ON_ERROR) : null @@ -917,7 +919,7 @@ private function cascadeRestrictionRelations( -- create new restriction relations... -- -------------------------------- SELECT - "' . (string)$contentStreamId . '" as contentstreamid, + "' . $contentStreamId->value . '" as contentstreamid, tree.dimensionspacepointhash, originnodeaggregateid, tree.nodeaggregateid as affectednodeaggregateid @@ -933,9 +935,9 @@ private function cascadeRestrictionRelations( ) AS joinedrestrictingancestors ', [ - 'contentStreamId' => (string)$contentStreamId, - 'parentNodeAggregateId' => (string)$parentNodeAggregateId, - 'entryNodeAggregateId' => (string)$entryNodeAggregateId, + 'contentStreamId' => $contentStreamId->value, + 'parentNodeAggregateId' => $parentNodeAggregateId->value, + 'entryNodeAggregateId' => $entryNodeAggregateId->value, 'dimensionSpacePointHashes' => $affectedDimensionSpacePoints->getPointHashes(), 'affectedDimensionSpacePointHashes' => $affectedDimensionSpacePoints->getPointHashes() ], @@ -1008,7 +1010,7 @@ protected function copyNodeToDimensionSpacePoint( $copy = new NodeRecord( $copyRelationAnchorPoint, $sourceNode->nodeAggregateId, - $originDimensionSpacePoint->jsonSerialize(), + $originDimensionSpacePoint->coordinates, $originDimensionSpacePoint->hash, $sourceNode->properties, $sourceNode->nodeTypeName, @@ -1082,9 +1084,9 @@ private function updateNodeRecordWithCopyOnWrite( :originalNodeAnchor IN (h.childnodeanchor, h.parentnodeanchor) AND h.contentstreamid = :contentStreamId', [ - 'newNodeAnchor' => (string)$copiedNode->relationAnchorPoint, - 'originalNodeAnchor' => (string)$anchorPoint, - 'contentStreamId' => (string)$contentStreamIdWhereWriteOccurs + 'newNodeAnchor' => $copiedNode->relationAnchorPoint->value, + 'originalNodeAnchor' => $anchorPoint->value, + 'contentStreamId' => $contentStreamIdWhereWriteOccurs->value, ] ); @@ -1128,8 +1130,8 @@ private function copyReferenceRelations( ' . $this->tableNamePrefix . '_referencerelation ref WHERE ref.nodeanchorpoint = :sourceNodeAnchorPoint ', [ - 'sourceNodeAnchorPoint' => (string)$sourceRelationAnchorPoint, - 'destinationRelationAnchorPoint' => (string)$destinationRelationAnchorPoint + 'sourceNodeAnchorPoint' => $sourceRelationAnchorPoint->value, + 'destinationRelationAnchorPoint' => $destinationRelationAnchorPoint->value ]); } @@ -1154,7 +1156,7 @@ private function whenDimensionSpacePointWasMoved(DimensionSpacePointWasMoved $ev ', [ 'dimensionSpacePointHash' => $event->source->hash, - 'contentStreamId' => (string)$event->contentStreamId + 'contentStreamId' => $event->contentStreamId->value ] ); while ($res = $rel->fetchAssociative()) { @@ -1163,7 +1165,7 @@ private function whenDimensionSpacePointWasMoved(DimensionSpacePointWasMoved $ev $event->contentStreamId, $relationAnchorPoint, function (NodeRecord $nodeRecord) use ($event) { - $nodeRecord->originDimensionSpacePoint = $event->target->jsonSerialize(); + $nodeRecord->originDimensionSpacePoint = $event->target->coordinates; $nodeRecord->originDimensionSpacePointHash = $event->target->hash; } ); @@ -1183,8 +1185,8 @@ function (NodeRecord $nodeRecord) use ($event) { [ 'originalDimensionSpacePointHash' => $event->source->hash, 'newDimensionSpacePointHash' => $event->target->hash, - 'newDimensionSpacePoint' => json_encode($event->target->jsonSerialize()), - 'contentStreamId' => (string)$event->contentStreamId + 'newDimensionSpacePoint' => $event->target->toJson(), + 'contentStreamId' => $event->contentStreamId->value ] ); @@ -1201,7 +1203,7 @@ function (NodeRecord $nodeRecord) use ($event) { [ 'originalDimensionSpacePointHash' => $event->source->hash, 'newDimensionSpacePointHash' => $event->target->hash, - 'contentStreamId' => (string)$event->contentStreamId + 'contentStreamId' => $event->contentStreamId->value ] ); }); @@ -1235,10 +1237,10 @@ private function whenDimensionShineThroughWasAdded(DimensionShineThroughWasAdded WHERE h.contentstreamid = :contentStreamId AND h.dimensionspacepointhash = :sourceDimensionSpacePointHash', [ - 'contentStreamId' => $event->contentStreamId->jsonSerialize(), + 'contentStreamId' => $event->contentStreamId->value, 'sourceDimensionSpacePointHash' => $event->source->hash, 'newDimensionSpacePointHash' => $event->target->hash, - 'newDimensionSpacePoint' => json_encode($event->target->jsonSerialize()), + 'newDimensionSpacePoint' => $event->target->toJson(), ] ); @@ -1261,7 +1263,7 @@ private function whenDimensionShineThroughWasAdded(DimensionShineThroughWasAdded AND r.dimensionspacepointhash = :sourceDimensionSpacePointHash ', [ - 'contentStreamId' => (string)$event->contentStreamId, + 'contentStreamId' => $event->contentStreamId->value, 'sourceDimensionSpacePointHash' => $event->source->hash, 'targetDimensionSpacePointHash' => $event->target->hash ]); diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjectionFactory.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjectionFactory.php index 6c5f4bc45ba..f9bc58758ea 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjectionFactory.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjectionFactory.php @@ -32,7 +32,7 @@ public function __construct( public static function graphProjectionTableNamePrefix( ContentRepositoryId $contentRepositoryId ): string { - return sprintf('cr_%s_p_graph', $contentRepositoryId); + return sprintf('cr_%s_p_graph', $contentRepositoryId->value); } public function build( diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/Feature/NodeDisabling.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/Feature/NodeDisabling.php index 05651879598..e3ade9c7eb2 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/Feature/NodeDisabling.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/Feature/NodeDisabling.php @@ -76,15 +76,15 @@ private function whenNodeAggregateWasDisabled(NodeAggregateWasDisabled $event): ) select - "' . $event->contentStreamId . '" as contentstreamid, + "' . $event->contentStreamId->value . '" as contentstreamid, dimensionspacepointhash, - "' . $event->nodeAggregateId . '" as originnodeaggregateid, + "' . $event->nodeAggregateId->value . '" as originnodeaggregateid, nodeaggregateid as affectednodeaggregateid from tree ', [ - 'entryNodeAggregateId' => (string)$event->nodeAggregateId, - 'contentStreamId' => (string)$event->contentStreamId, + 'entryNodeAggregateId' => $event->nodeAggregateId->value, + 'contentStreamId' => $event->contentStreamId->value, 'dimensionSpacePointHashes' => $event->affectedDimensionSpacePoints->getPointHashes() ], [ diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/Feature/NodeRemoval.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/Feature/NodeRemoval.php index 10c3ff66a2f..25b0a0d8810 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/Feature/NodeRemoval.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/Feature/NodeRemoval.php @@ -87,7 +87,7 @@ protected function removeRelationRecursivelyFromDatabaseIncludingNonReferencedNo AND h.contentstreamid IS NULL ', [ - 'anchorPointForNode' => (string)$ingoingRelation->childNodeAnchor, + 'anchorPointForNode' => $ingoingRelation->childNodeAnchor->value, ] ); } diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/Feature/RestrictionRelations.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/Feature/RestrictionRelations.php index 6a4ec11cec6..1e3ebed5081 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/Feature/RestrictionRelations.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/Feature/RestrictionRelations.php @@ -40,8 +40,8 @@ private function removeOutgoingRestrictionRelationsOfNodeAggregateInDimensionSpa AND r.originnodeaggregateid = :originNodeAggregateId AND r.dimensionspacepointhash in (:dimensionSpacePointHashes)', [ - 'contentStreamId' => (string)$contentStreamId, - 'originNodeAggregateId' => (string)$originNodeAggregateId, + 'contentStreamId' => $contentStreamId->value, + 'originNodeAggregateId' => $originNodeAggregateId->value, 'dimensionSpacePointHashes' => $affectedDimensionSpacePoints->getPointHashes() ], [ @@ -111,8 +111,8 @@ private function removeAllRestrictionRelationsUnderneathNodeAggregate( and r.affectednodeaggregateid = tree.nodeaggregateid ', [ - 'entryNodeAggregateId' => (string)$nodeAggregateId, - 'contentStreamId' => (string)$contentStreamId, + 'entryNodeAggregateId' => $nodeAggregateId->value, + 'contentStreamId' => $contentStreamId->value, ] ); } @@ -143,7 +143,7 @@ private function removeAllRestrictionRelationsInSubtreeImposedByAncestors( AND r.affectednodeaggregateid IN (:descendantNodeAggregateIds) AND r.dimensionspacepointhash IN (:affectedDimensionSpacePointHashes)', [ - 'contentStreamId' => (string)$contentStreamId, + 'contentStreamId' => $contentStreamId->value, 'descendantNodeAggregateIds' => array_keys($descendantNodeAggregateIds), 'affectedDimensionSpacePointHashes' => $affectedDimensionSpacePoints->getPointHashes() ], diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/HierarchyRelation.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/HierarchyRelation.php index 40d86141b65..3908f24fcaa 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/HierarchyRelation.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/HierarchyRelation.php @@ -43,11 +43,11 @@ public function __construct( public function addToDatabase(Connection $databaseConnection, string $tableNamePrefix): void { $databaseConnection->insert($tableNamePrefix . '_hierarchyrelation', [ - 'parentnodeanchor' => $this->parentNodeAnchor, - 'childnodeanchor' => $this->childNodeAnchor, - 'name' => $this->name, - 'contentstreamid' => $this->contentStreamId, - 'dimensionspacepoint' => json_encode($this->dimensionSpacePoint), + 'parentnodeanchor' => $this->parentNodeAnchor->value, + 'childnodeanchor' => $this->childNodeAnchor->value, + 'name' => $this->name?->value, + 'contentstreamid' => $this->contentStreamId->value, + 'dimensionspacepoint' => $this->dimensionSpacePoint->toJson(), 'dimensionspacepointhash' => $this->dimensionSpacePointHash, 'position' => $this->position ]); @@ -73,7 +73,7 @@ public function assignNewChildNode( $databaseConnection->update( $tableNamePrefix . '_hierarchyrelation', [ - 'childnodeanchor' => $childAnchorPoint + 'childnodeanchor' => $childAnchorPoint->value ], $this->getDatabaseId() ); @@ -89,7 +89,7 @@ public function assignNewParentNode( string $tableNamePrefix ): void { $data = [ - 'parentnodeanchor' => $parentAnchorPoint + 'parentnodeanchor' => $parentAnchorPoint->value ]; if (!is_null($position)) { $data['position'] = $position; @@ -118,9 +118,9 @@ public function assignNewPosition(int $position, Connection $databaseConnection, public function getDatabaseId(): array { return [ - 'parentnodeanchor' => $this->parentNodeAnchor, - 'childnodeanchor' => $this->childNodeAnchor, - 'contentstreamid' => $this->contentStreamId, + 'parentnodeanchor' => $this->parentNodeAnchor->value, + 'childnodeanchor' => $this->childNodeAnchor->value, + 'contentstreamid' => $this->contentStreamId->value, 'dimensionspacepointhash' => $this->dimensionSpacePointHash ]; } diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/NodeRecord.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/NodeRecord.php index 455397d4720..bb5781192d2 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/NodeRecord.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/NodeRecord.php @@ -52,12 +52,12 @@ public function __construct( public function addToDatabase(Connection $databaseConnection, string $tableNamePrefix): void { $databaseConnection->insert($tableNamePrefix . '_node', [ - 'relationanchorpoint' => (string)$this->relationAnchorPoint, - 'nodeaggregateid' => (string)$this->nodeAggregateId, + 'relationanchorpoint' => $this->relationAnchorPoint->value, + 'nodeaggregateid' => $this->nodeAggregateId->value, 'origindimensionspacepoint' => json_encode($this->originDimensionSpacePoint), 'origindimensionspacepointhash' => $this->originDimensionSpacePointHash, 'properties' => json_encode($this->properties), - 'nodetypename' => (string)$this->nodeTypeName, + 'nodetypename' => $this->nodeTypeName->value, 'classification' => $this->classification->value, 'created' => $this->timestamps->created, 'originalcreated' => $this->timestamps->originalCreated, @@ -80,17 +80,17 @@ public function updateToDatabase(Connection $databaseConnection, string $tableNa $databaseConnection->update( $tableNamePrefix . '_node', [ - 'nodeaggregateid' => (string)$this->nodeAggregateId, + 'nodeaggregateid' => $this->nodeAggregateId->value, 'origindimensionspacepoint' => json_encode($this->originDimensionSpacePoint), 'origindimensionspacepointhash' => $this->originDimensionSpacePointHash, 'properties' => json_encode($this->properties), - 'nodetypename' => (string)$this->nodeTypeName, + 'nodetypename' => $this->nodeTypeName->value, 'classification' => $this->classification->value, 'lastmodified' => $this->timestamps->lastModified, 'originallastmodified' => $this->timestamps->originalLastModified, ], [ - 'relationanchorpoint' => $this->relationAnchorPoint + 'relationanchorpoint' => $this->relationAnchorPoint->value ], [ 'lastmodified' => Types::DATETIME_IMMUTABLE, @@ -107,7 +107,7 @@ public function updateToDatabase(Connection $databaseConnection, string $tableNa public function removeFromDatabase(Connection $databaseConnection, string $tableNamePrefix): void { $databaseConnection->delete($tableNamePrefix . '_node', [ - 'relationanchorpoint' => $this->relationAnchorPoint + 'relationanchorpoint' => $this->relationAnchorPoint->value ]); } diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/NodeRelationAnchorPoint.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/NodeRelationAnchorPoint.php index 71076b7efa5..d493cf8d0b0 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/NodeRelationAnchorPoint.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/NodeRelationAnchorPoint.php @@ -21,10 +21,10 @@ * * @internal */ -class NodeRelationAnchorPoint implements \JsonSerializable, \Stringable +class NodeRelationAnchorPoint implements \JsonSerializable { private function __construct( - private string $value + public readonly string $value ) { } @@ -48,8 +48,8 @@ public function jsonSerialize(): string return $this->value; } - public function __toString(): string + public function equals(self $other): bool { - return $this->value; + return $other->value === $this->value; } } diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/ProjectionIntegrityViolationDetector.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/ProjectionIntegrityViolationDetector.php index 900b7a66ad3..1ee0e3e106b 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/ProjectionIntegrityViolationDetector.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/ProjectionIntegrityViolationDetector.php @@ -54,7 +54,7 @@ public function hierarchyIntegrityIsProvided(): Result OR c.relationanchorpoint IS NULL )', [ - 'rootNodeAnchor' => NodeRelationAnchorPoint::forRootEdge() + 'rootNodeAnchor' => NodeRelationAnchorPoint::forRootEdge()->value ] ); @@ -89,7 +89,7 @@ public function hierarchyIntegrityIsProvided(): Result HAVING uniquenessCounter > 1 ', [ - 'rootNodeAnchor' => NodeRelationAnchorPoint::forRootEdge() + 'rootNodeAnchor' => NodeRelationAnchorPoint::forRootEdge()->value ] )->fetchAllAssociative(); @@ -353,8 +353,8 @@ public function allNodesAreConnectedToARootNodePerSubgraph(): Result AND h.dimensionspacepointhash = :dimensionSpacePointHash AND relationanchorpoint NOT IN (SELECT * FROM subgraph)', [ - 'rootAnchorPoint' => NodeRelationAnchorPoint::forRootEdge(), - 'contentStreamId' => (string)$contentStreamId, + 'rootAnchorPoint' => NodeRelationAnchorPoint::forRootEdge()->value, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash ] )->fetchAllAssociative(); @@ -365,8 +365,8 @@ public function allNodesAreConnectedToARootNodePerSubgraph(): Result }, $nodeAggregateIdsInCycles); $result->addError(new Error( - 'Subgraph defined by content strean ' . $contentStreamId - . ' and dimension space point ' . (string) $dimensionSpacePoint + 'Subgraph defined by content strean ' . $contentStreamId->value + . ' and dimension space point ' . $dimensionSpacePoint->toJson() . ' is cyclic for node aggregates ' . implode(',', $nodeAggregateIdsInCycles), self::ERROR_CODE_NODE_IS_DISCONNECTED_FROM_THE_ROOT @@ -407,7 +407,7 @@ public function nodeAggregateIdsAreUniquePerSubgraph(): Result GROUP BY n.nodeaggregateid HAVING COUNT(DISTINCT(n.relationanchorpoint)) > 1', [ - 'contentStreamId' => (string)$contentStreamId, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash ] )->fetchAllAssociative(); @@ -415,8 +415,8 @@ public function nodeAggregateIdsAreUniquePerSubgraph(): Result foreach ($ambiguousNodeAggregateRecords as $ambiguousRecord) { $result->addError(new Error( 'Node aggregate ' . $ambiguousRecord['nodeaggregateid'] - . ' is ambiguous in content stream ' . $contentStreamId - . ' and dimension space point ' . (string) $dimensionSpacePoint, + . ' is ambiguous in content stream ' . $contentStreamId->value + . ' and dimension space point ' . $dimensionSpacePoint->toJson(), self::ERROR_CODE_AMBIGUOUS_NODE_AGGREGATE_IN_SUBGRAPH )); } @@ -444,7 +444,7 @@ public function allNodesHaveAtMostOneParentPerSubgraph(): Result GROUP BY c.relationanchorpoint HAVING COUNT(DISTINCT(h.parentnodeanchor)) > 1', [ - 'contentStreamId' => (string)$contentStreamId, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash ] )->fetchAllAssociative(); @@ -452,8 +452,8 @@ public function allNodesHaveAtMostOneParentPerSubgraph(): Result foreach ($nodeRecordsWithMultipleParents as $record) { $result->addError(new Error( 'Node aggregate ' . $record['nodeaggregateid'] - . ' has multiple parents in content stream ' . $contentStreamId - . ' and dimension space point ' . (string) $dimensionSpacePoint, + . ' has multiple parents in content stream ' . $contentStreamId->value + . ' and dimension space point ' . $dimensionSpacePoint->toJson(), self::ERROR_CODE_NODE_HAS_MULTIPLE_PARENTS )); } @@ -482,15 +482,15 @@ public function nodeAggregatesAreConsistentlyTypedPerContentStream(): Result WHERE h.contentstreamid = :contentStreamId AND n.nodeaggregateid = :nodeAggregateId', [ - 'contentStreamId' => (string)$contentStreamId, - 'nodeAggregateId' => (string)$nodeAggregateId + 'contentStreamId' => $contentStreamId->value, + 'nodeAggregateId' => $nodeAggregateId->value ] )->fetchAllAssociative(); if (count($nodeAggregateRecords) > 1) { $result->addError(new Error( - 'Node aggregate ' . $nodeAggregateId - . ' in content stream ' . $contentStreamId + 'Node aggregate ' . $nodeAggregateId->value + . ' in content stream ' . $contentStreamId->value . ' is of ambiguous type ("' . implode('","', array_map( function (array $record) { return $record['nodetypename']; @@ -525,15 +525,15 @@ public function nodeAggregatesAreConsistentlyClassifiedPerContentStream(): Resul WHERE h.contentstreamid = :contentStreamId AND n.nodeaggregateid = :nodeAggregateId', [ - 'contentStreamId' => (string)$contentStreamId, - 'nodeAggregateId' => (string)$nodeAggregateId + 'contentStreamId' => $contentStreamId->value, + 'nodeAggregateId' => $nodeAggregateId->value ] )->fetchAllAssociative(); if (count($nodeAggregateRecords) > 1) { $result->addError(new Error( - 'Node aggregate ' . $nodeAggregateId - . ' in content stream ' . $contentStreamId + 'Node aggregate ' . $nodeAggregateId->value + . ' in content stream ' . $contentStreamId->value . ' is ambiguously classified ("' . implode('","', array_map( function (array $record) { return $record['classification']; @@ -568,14 +568,14 @@ public function childNodeCoverageIsASubsetOfParentNodeCoverage(): Result AND c.dimensionspacepointhash = p.dimensionspacepointhash AND p.childnodeanchor IS NULL', [ - 'contentStreamId' => (string)$contentStreamId + 'contentStreamId' => $contentStreamId->value ] )->fetchAllAssociative(); foreach ($excessivelyCoveringNodeRecords as $excessivelyCoveringNodeRecord) { $result->addError(new Error( 'Node aggregate ' . $excessivelyCoveringNodeRecord['nodeaggregateid'] - . ' in content stream ' . $contentStreamId + . ' in content stream ' . $contentStreamId->value . ' covers dimension space point ' . $excessivelyCoveringNodeRecord['dimensionspacepoint'] . ' but its parent does not.', self::ERROR_CODE_CHILD_NODE_COVERAGE_IS_NO_SUBSET_OF_PARENT_NODE_COVERAGE @@ -611,7 +611,7 @@ public function allNodesCoverTheirOrigin(): Result ) AND classification != :rootClassification', [ - 'contentStreamId' => (string)$contentStreamId, + 'contentStreamId' => $contentStreamId->value, 'rootClassification' => NodeAggregateClassification::CLASSIFICATION_ROOT->value ] )->fetchAllAssociative(); @@ -619,7 +619,7 @@ public function allNodesCoverTheirOrigin(): Result foreach ($nodeRecordsWithMissingOriginCoverage as $nodeRecord) { $result->addError(new Error( 'Node aggregate ' . $nodeRecord['nodeaggregateid'] - . ' in content stream ' . $contentStreamId + . ' in content stream ' . $contentStreamId->value . ' does not cover its origin dimension space point ' . $nodeRecord['origindimensionspacepoint'] . '.', self::ERROR_CODE_NODE_DOES_NOT_COVER_ITS_ORIGIN diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentGraph.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentGraph.php index de835f37d07..18df5147ac2 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentGraph.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentGraph.php @@ -65,7 +65,7 @@ final public function getSubgraph( DimensionSpacePoint $dimensionSpacePoint, VisibilityConstraints $visibilityConstraints ): ContentSubgraphInterface { - $index = $contentStreamId . '-' . $dimensionSpacePoint->hash . '-' . $visibilityConstraints->getHash(); + $index = $contentStreamId->value . '-' . $dimensionSpacePoint->hash . '-' . $visibilityConstraints->getHash(); if (!isset($this->subgraphs[$index])) { $this->subgraphs[$index] = new ContentSubgraphWithRuntimeCaches( new ContentSubgraph( @@ -104,9 +104,9 @@ public function findNodeByIdAndOriginDimensionSpacePoint( AND n.origindimensionspacepointhash = :originDimensionSpacePointHash AND h.contentstreamid = :contentStreamId', [ - 'nodeAggregateId' => (string)$nodeAggregateId, + 'nodeAggregateId' => $nodeAggregateId->value, 'originDimensionSpacePointHash' => $originDimensionSpacePoint->hash, - 'contentStreamId' => (string)$contentStreamId + 'contentStreamId' => $contentStreamId->value ] )->fetchAssociative(); @@ -161,13 +161,13 @@ public function findRootNodeAggregates( AND h.parentnodeanchor = :rootEdgeParentAnchorId '; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, - 'rootEdgeParentAnchorId' => (string)NodeRelationAnchorPoint::forRootEdge(), + 'contentStreamId' => $contentStreamId->value, + 'rootEdgeParentAnchorId' => NodeRelationAnchorPoint::forRootEdge()->value, ]; if ($filter->nodeTypeName !== null) { $query .= ' AND n.nodetypename = :nodeTypeName'; - $parameters['nodeTypeName'] = (string)$filter->nodeTypeName; + $parameters['nodeTypeName'] = $filter->nodeTypeName->value; } @@ -197,8 +197,8 @@ public function findNodeAggregatesByType( AND n.nodetypename = :nodeTypeName'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, - 'nodeTypeName' => (string)$nodeTypeName, + 'contentStreamId' => $contentStreamId->value, + 'nodeTypeName' => $nodeTypeName->value, ]; $resultStatement = $connection->executeQuery($query, $parameters)->fetchAllAssociative(); @@ -232,8 +232,8 @@ public function findNodeAggregateById( WHERE n.nodeaggregateid = :nodeAggregateId AND h.contentstreamid = :contentStreamId'; $parameters = [ - 'nodeAggregateId' => (string)$nodeAggregateId, - 'contentStreamId' => (string)$contentStreamId + 'nodeAggregateId' => $nodeAggregateId->value, + 'contentStreamId' => $contentStreamId->value ]; $nodeRows = $connection->executeQuery($query, $parameters)->fetchAllAssociative(); @@ -273,8 +273,8 @@ public function findParentNodeAggregates( AND ph.contentstreamid = :contentStreamId AND ch.contentstreamid = :contentStreamId'; $parameters = [ - 'nodeAggregateId' => (string)$childNodeAggregateId, - 'contentStreamId' => (string)$contentStreamId + 'nodeAggregateId' => $childNodeAggregateId->value, + 'contentStreamId' => $contentStreamId->value ]; $nodeRows = $connection->executeQuery($query, $parameters)->fetchAllAssociative(); @@ -321,8 +321,8 @@ public function findParentNodeAggregateByChildOriginDimensionSpacePoint( AND h.contentstreamid = :contentStreamId'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, - 'childNodeAggregateId' => (string)$childNodeAggregateId, + 'contentStreamId' => $contentStreamId->value, + 'childNodeAggregateId' => $childNodeAggregateId->value, 'childOriginDimensionSpacePointHash' => $childOriginDimensionSpacePoint->hash, ]; @@ -347,8 +347,8 @@ public function findChildNodeAggregates( $query = $this->createChildNodeAggregateQuery(); $parameters = [ - 'parentNodeAggregateId' => (string) $parentNodeAggregateId, - 'contentStreamId' => (string) $contentStreamId + 'parentNodeAggregateId' => $parentNodeAggregateId->value, + 'contentStreamId' => $contentStreamId->value ]; $nodeRows = $connection->executeQuery($query, $parameters)->fetchAllAssociative(); @@ -374,9 +374,9 @@ public function findChildNodeAggregatesByName( AND ch.name = :relationName'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, - 'parentNodeAggregateId' => (string)$parentNodeAggregateId, - 'relationName' => (string)$name + 'contentStreamId' => $contentStreamId->value, + 'parentNodeAggregateId' => $parentNodeAggregateId->value, + 'relationName' => $name->value ]; $nodeRows = $connection->executeQuery($query, $parameters)->fetchAllAssociative(); @@ -401,8 +401,8 @@ public function findTetheredChildNodeAggregates( AND c.classification = :tetheredClassification'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, - 'parentNodeAggregateId' => (string)$parentNodeAggregateId, + 'contentStreamId' => $contentStreamId->value, + 'parentNodeAggregateId' => $parentNodeAggregateId->value, 'tetheredClassification' => NodeAggregateClassification::CLASSIFICATION_TETHERED->value ]; @@ -467,11 +467,11 @@ public function getDimensionSpacePointsOccupiedByChildNodeName( AND h.dimensionspacepointhash IN (:dimensionSpacePointHashes) AND h.name = :nodeName'; $parameters = [ - 'parentNodeAggregateId' => (string)$parentNodeAggregateId, + 'parentNodeAggregateId' => $parentNodeAggregateId->value, 'parentNodeOriginDimensionSpacePointHash' => $parentNodeOriginDimensionSpacePoint->hash, - 'contentStreamId' => (string) $contentStreamId, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHashes' => $dimensionSpacePointsToCheck->getPointHashes(), - 'nodeName' => (string) $nodeName + 'nodeName' => $nodeName->value ]; $types = [ 'dimensionSpacePointHashes' => Connection::PARAM_STR_ARRAY diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php index 8d5aca2af17..b81ea9094a0 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php @@ -214,7 +214,7 @@ public function findChildNodeConnectedThroughEdgeName(NodeAggregateId $parentNod ->where('pn.nodeaggregateid = :parentNodeAggregateId')->setParameter('parentNodeAggregateId', $parentNodeAggregateId->value) ->andWhere('h.contentstreamid = :contentStreamId')->setParameter('contentStreamId', $this->contentStreamId->value) ->andWhere('h.dimensionspacepointhash = :dimensionSpacePointHash')->setParameter('dimensionSpacePointHash', $this->dimensionSpacePoint->hash) - ->andWhere('h.name = :edgeName')->setParameter('edgeName', (string)$edgeName); + ->andWhere('h.name = :edgeName')->setParameter('edgeName', $edgeName->value); $this->addRestrictionRelationConstraints($queryBuilder, 'cn'); return $this->fetchNode($queryBuilder); } diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ProjectionContentGraph.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ProjectionContentGraph.php index 88204fbda02..bc50f02c909 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ProjectionContentGraph.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ProjectionContentGraph.php @@ -63,8 +63,8 @@ public function findParentNode( ?DimensionSpacePoint $coveredDimensionSpacePoint = null ): ?NodeRecord { $params = [ - 'contentStreamId' => (string)$contentStreamId, - 'childNodeAggregateId' => (string)$childNodeAggregateId, + 'contentStreamId' => $contentStreamId->value, + 'childNodeAggregateId' => $childNodeAggregateId->value, 'originDimensionSpacePointHash' => $originDimensionSpacePoint->hash, 'coveredDimensionSpacePointHash' => $coveredDimensionSpacePoint ? $coveredDimensionSpacePoint->hash @@ -107,8 +107,8 @@ public function findNodeInAggregate( AND h.contentstreamid = :contentStreamId AND h.dimensionspacepointhash = :dimensionSpacePointHash', [ - 'contentStreamId' => (string)$contentStreamId, - 'nodeAggregateId' => (string)$nodeAggregateId, + 'contentStreamId' => $contentStreamId->value, + 'nodeAggregateId' => $nodeAggregateId->value, 'dimensionSpacePointHash' => $coveredDimensionSpacePoint->hash ] )->fetchAssociative(); @@ -135,8 +135,8 @@ public function findNodeByIds( AND n.origindimensionspacepointhash = :originDimensionSpacePointHash AND h.contentstreamid = :contentStreamId', [ - 'contentStreamId' => (string)$contentStreamId, - 'nodeAggregateId' => (string)$nodeAggregateId, + 'contentStreamId' => $contentStreamId->value, + 'nodeAggregateId' => $nodeAggregateId->value, 'originDimensionSpacePointHash' => $originDimensionSpacePoint->hash ] )->fetchAssociative(); @@ -163,9 +163,9 @@ public function getAnchorPointForNodeAndOriginDimensionSpacePointAndContentStrea AND n.origindimensionspacepointhash = :originDimensionSpacePointHash AND h.contentstreamid = :contentStreamId', [ - 'nodeAggregateId' => (string)$nodeAggregateId, + 'nodeAggregateId' => $nodeAggregateId->value, 'originDimensionSpacePointHash' => $originDimensionSpacePoint->hash, - 'contentStreamId' => (string)$contentStreamId, + 'contentStreamId' => $contentStreamId->value, ] )->fetchAllAssociative(); @@ -197,8 +197,8 @@ public function getAnchorPointsForNodeAggregateInContentStream( WHERE n.nodeaggregateid = :nodeAggregateId AND h.contentstreamid = :contentStreamId', [ - 'nodeAggregateId' => (string)$nodeAggregateId, - 'contentStreamId' => (string)$contentStreamId, + 'nodeAggregateId' => $nodeAggregateId->value, + 'contentStreamId' => $contentStreamId->value, ] )->fetchAllAssociative(); @@ -219,7 +219,7 @@ public function getNodeByAnchorPoint(NodeRelationAnchorPoint $nodeRelationAnchor 'SELECT n.* FROM ' . $this->tableNamePrefix . '_node n WHERE n.relationanchorpoint = :relationAnchorPoint', [ - 'relationAnchorPoint' => (string)$nodeRelationAnchorPoint, + 'relationAnchorPoint' => $nodeRelationAnchorPoint->value, ] )->fetchAssociative(); @@ -256,14 +256,14 @@ public function determineHierarchyRelationPosition( AND h.contentstreamid = :contentStreamId AND h.dimensionspacepointhash = :dimensionSpacePointHash', [ - 'succeedingSiblingAnchorPoint' => (string)$succeedingSiblingAnchorPoint, - 'contentStreamId' => (string)$contentStreamId, + 'succeedingSiblingAnchorPoint' => $succeedingSiblingAnchorPoint->value, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash ] )->fetchAssociative(); $succeedingSiblingPosition = (int)$succeedingSiblingRelation['position']; - $parentAnchorPoint = $succeedingSiblingRelation['parentnodeanchor']; + $parentAnchorPoint = NodeRelationAnchorPoint::fromString($succeedingSiblingRelation['parentnodeanchor']); $precedingSiblingData = $this->getDatabaseConnection()->executeQuery( 'SELECT MAX(h.position) AS position FROM ' . $this->tableNamePrefix . '_hierarchyrelation h @@ -272,8 +272,8 @@ public function determineHierarchyRelationPosition( AND h.dimensionspacepointhash = :dimensionSpacePointHash AND h.position < :position', [ - 'anchorPoint' => $parentAnchorPoint, - 'contentStreamId' => (string)$contentStreamId, + 'anchorPoint' => $parentAnchorPoint->value, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash, 'position' => $succeedingSiblingPosition ] @@ -297,8 +297,8 @@ public function determineHierarchyRelationPosition( AND h.contentstreamid = :contentStreamId AND h.dimensionspacepointhash = :dimensionSpacePointHash', [ - 'childAnchorPoint' => $childAnchorPoint, - 'contentStreamId' => (string)$contentStreamId, + 'childAnchorPoint' => $childAnchorPoint->value, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash ] )->fetchAssociative(); @@ -312,8 +312,8 @@ public function determineHierarchyRelationPosition( AND h.contentstreamid = :contentStreamId AND h.dimensionspacepointhash = :dimensionSpacePointHash', [ - 'parentAnchorPoint' => $parentAnchorPoint, - 'contentStreamId' => (string)$contentStreamId, + 'parentAnchorPoint' => $parentAnchorPoint->value, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash ] )->fetchAssociative(); @@ -349,8 +349,8 @@ public function getOutgoingHierarchyRelationsForNodeAndSubgraph( AND h.contentstreamid = :contentStreamId AND h.dimensionspacepointhash = :dimensionSpacePointHash', [ - 'parentAnchorPoint' => (string)$parentAnchorPoint, - 'contentStreamId' => (string)$contentStreamId, + 'parentAnchorPoint' => $parentAnchorPoint->value, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash ] )->fetchAllAssociative() as $relationData @@ -381,8 +381,8 @@ public function getIngoingHierarchyRelationsForNodeAndSubgraph( AND h.contentstreamid = :contentStreamId AND h.dimensionspacepointhash = :dimensionSpacePointHash', [ - 'childAnchorPoint' => (string)$childAnchorPoint, - 'contentStreamId' => (string)$contentStreamId, + 'childAnchorPoint' => $childAnchorPoint->value, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash ] )->fetchAllAssociative() as $relationData @@ -410,8 +410,8 @@ public function findIngoingHierarchyRelationsForNode( WHERE h.childnodeanchor = :childAnchorPoint AND h.contentstreamid = :contentStreamId'; $parameters = [ - 'childAnchorPoint' => (string)$childAnchorPoint, - 'contentStreamId' => (string)$contentStreamId + 'childAnchorPoint' => $childAnchorPoint->value, + 'contentStreamId' => $contentStreamId->value ]; $types = []; @@ -448,8 +448,8 @@ public function findOutgoingHierarchyRelationsForNode( WHERE h.parentnodeanchor = :parentAnchorPoint AND h.contentstreamid = :contentStreamId'; $parameters = [ - 'parentAnchorPoint' => (string)$parentAnchorPoint, - 'contentStreamId' => (string)$contentStreamId + 'parentAnchorPoint' => $parentAnchorPoint->value, + 'contentStreamId' => $contentStreamId->value ]; $types = []; @@ -490,8 +490,8 @@ public function findOutgoingHierarchyRelationsForNodeAggregate( AND h.contentstreamid = :contentStreamId AND h.dimensionspacepointhash IN (:dimensionSpacePointHashes)', [ - 'nodeAggregateId' => (string)$nodeAggregateId, - 'contentStreamId' => (string)$contentStreamId, + 'nodeAggregateId' => $nodeAggregateId->value, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHashes' => $dimensionSpacePointSet->getPointHashes() ], [ @@ -524,8 +524,8 @@ public function findIngoingHierarchyRelationsForNodeAggregate( WHERE n.nodeaggregateid = :nodeAggregateId AND h.contentstreamid = :contentStreamId'; $parameters = [ - 'nodeAggregateId' => (string)$nodeAggregateId, - 'contentStreamId' => (string)$contentStreamId, + 'nodeAggregateId' => $nodeAggregateId->value, + 'contentStreamId' => $contentStreamId->value, ]; $types = []; @@ -560,7 +560,7 @@ public function getAllContentStreamIdsAnchorPointIsContainedIn( FROM ' . $this->tableNamePrefix . '_hierarchyrelation h WHERE h.childnodeanchor = :nodeRelationAnchorPoint', [ - 'nodeRelationAnchorPoint' => (string)$nodeRelationAnchorPoint, + 'nodeRelationAnchorPoint' => $nodeRelationAnchorPoint->value, ] )->fetchAllAssociative() as $row ) { @@ -625,8 +625,8 @@ public function findDescendantNodeAggregateIds( select nodeaggregateid, dimensionspacepointhash from nestedNodes ', [ - 'entryNodeAggregateId' => (string)$entryNodeAggregateId, - 'contentStreamId' => (string)$contentStreamId, + 'entryNodeAggregateId' => $entryNodeAggregateId->value, + 'contentStreamId' => $contentStreamId->value, 'affectedDimensionSpacePointHashes' => $affectedDimensionSpacePoints->getPointHashes() ], [ diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Feature/ContentStreamForking.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Feature/ContentStreamForking.php index bcebb2c61ae..2c51f597241 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Feature/ContentStreamForking.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Feature/ContentStreamForking.php @@ -33,8 +33,8 @@ private function whenContentStreamWasForked(ContentStreamWasForked $event): void { $this->transactional(function () use ($event) { $parameters = [ - 'sourceContentStreamId' => (string)$event->sourceContentStreamId, - 'targetContentStreamId' => (string)$event->newContentStreamId + 'sourceContentStreamId' => $event->sourceContentStreamId->value, + 'targetContentStreamId' => $event->newContentStreamId->value ]; $this->getDatabaseConnection()->executeQuery(/** @lang PostgreSQL */ diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Feature/NodeReferencing.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Feature/NodeReferencing.php index 755cfc3caaf..4becf3ef57a 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Feature/NodeReferencing.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Feature/NodeReferencing.php @@ -53,8 +53,8 @@ function (NodeRecord $node) { // remove old $this->getDatabaseConnection()->delete($this->tableNamePrefix . '_referencerelation', [ - 'sourcenodeanchor' => $anchorPoint, - 'name' => $event->referenceName + 'sourcenodeanchor' => $anchorPoint->value, + 'name' => $event->referenceName->value ]); // set new diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Feature/NodeVariation.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Feature/NodeVariation.php index e246437a214..6f0a93ca812 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Feature/NodeVariation.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Feature/NodeVariation.php @@ -246,9 +246,9 @@ protected function replaceNodeRelationAnchorPoint( AND n.nodeaggregateid = :affectedNodeAggregateId )'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, - 'newNodeRelationAnchorPoint' => (string)$newNodeRelationAnchorPoint, - 'affectedNodeAggregateId' => (string)$affectedNodeAggregateId + 'contentStreamId' => $contentStreamId->value, + 'newNodeRelationAnchorPoint' => $newNodeRelationAnchorPoint->value, + 'affectedNodeAggregateId' => $affectedNodeAggregateId->value ]; foreach ($affectedDimensionSpacePointSet as $affectedDimensionSpacePoint) { $parentStatement = /** @lang PostgreSQL */ diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/HierarchyHyperrelationRecord.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/HierarchyHyperrelationRecord.php index 4392069ba6a..2a794e95d09 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/HierarchyHyperrelationRecord.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/HierarchyHyperrelationRecord.php @@ -73,7 +73,7 @@ public function replaceParentNodeAnchor( $databaseConnection->update( $tableNamePrefix . '_hierarchyhyperrelation', [ - 'parentnodeanchor' => (string)$newParentNodeAnchor + 'parentnodeanchor' => $newParentNodeAnchor->value ], $this->getDatabaseIdentifier() ); @@ -145,9 +145,9 @@ public function addToDatabase(Connection $databaseConnection, string $tableNameP $databaseConnection->insert( $tableNamePrefix . '_hierarchyhyperrelation', [ - 'contentstreamid' => $this->contentStreamId, - 'parentnodeanchor' => $this->parentNodeAnchor, - 'dimensionspacepoint' => \json_encode($this->dimensionSpacePoint), + 'contentstreamid' => $this->contentStreamId->value, + 'parentnodeanchor' => $this->parentNodeAnchor->value, + 'dimensionspacepoint' => $this->dimensionSpacePoint->toJson(), 'dimensionspacepointhash' => $this->dimensionSpacePoint->hash, 'childnodeanchors' => $this->childNodeAnchors->toDatabaseString() ] @@ -168,8 +168,8 @@ public function removeFromDatabase(Connection $databaseConnection, string $table public function getDatabaseIdentifier(): array { return [ - 'contentstreamid' => (string)$this->contentStreamId, - 'parentnodeanchor' => (string)$this->parentNodeAnchor, + 'contentstreamid' => $this->contentStreamId->value, + 'parentnodeanchor' => $this->parentNodeAnchor->value, 'dimensionspacepointhash' => $this->dimensionSpacePoint->hash ]; } diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/NodeAggregateIds.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/NodeAggregateIds.php index ae8bf47ad1e..4c549f719ce 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/NodeAggregateIds.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/NodeAggregateIds.php @@ -15,15 +15,15 @@ namespace Neos\ContentGraph\PostgreSQLAdapter\Domain\Projection; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; -use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateIds - as NodeAggregateIdCollection; +use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateIds as NodeAggregateIdCollection; /** * The node aggregate identifier value object collection * * @internal + * @implements \IteratorAggregate */ -final class NodeAggregateIds +final class NodeAggregateIds implements \IteratorAggregate { /** * @var array @@ -48,7 +48,7 @@ public static function fromArray(array $array): self if (is_string($item)) { $values[$item] = NodeAggregateId::fromString($item); } elseif ($item instanceof NodeAggregateId) { - $values[(string)$item] = $item; + $values[$item->value] = $item; } else { throw new \InvalidArgumentException( 'NodeAggregateIds can only consist of ' @@ -69,16 +69,6 @@ public static function fromCollection( ); } - public static function fromDatabaseString(string $databaseString): self - { - return self::fromArray(\explode(',', \trim($databaseString, '{}'))); - } - - public function toDatabaseString(): string - { - return '{' . implode(',', $this->ids) . '}'; - } - public function add( NodeAggregateId $nodeAggregateId, ?NodeAggregateId $succeedingSibling = null @@ -88,7 +78,7 @@ public function add( $pivot = (int)array_search($succeedingSibling, $nodeAggregateIds); array_splice($nodeAggregateIds, $pivot, 0, $nodeAggregateId); } else { - $nodeAggregateIds[(string)$nodeAggregateId] = $nodeAggregateId; + $nodeAggregateIds[$nodeAggregateId->value] = $nodeAggregateId; } return new self($nodeAggregateIds); @@ -97,8 +87,8 @@ public function add( public function remove(NodeAggregateId $nodeAggregateId): self { $identifiers = $this->ids; - if (isset($identifiers[(string) $nodeAggregateId])) { - unset($identifiers[(string) $nodeAggregateId]); + if (isset($identifiers[$nodeAggregateId->value])) { + unset($identifiers[$nodeAggregateId->value]); } return new self($identifiers); @@ -108,4 +98,9 @@ public function isEmpty(): bool { return count($this->ids) === 0; } + + public function getIterator(): \Traversable + { + return new \ArrayIterator($this->ids); + } } diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/NodeRecord.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/NodeRecord.php index ec03af82c69..c2c76a0e605 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/NodeRecord.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/NodeRecord.php @@ -90,14 +90,14 @@ public static function fromDatabaseRow(array $databaseRow): self public function addToDatabase(Connection $databaseConnection, string $tableNamePrefix): void { $databaseConnection->insert($tableNamePrefix . '_node', [ - 'relationanchorpoint' => (string) $this->relationAnchorPoint, - 'origindimensionspacepoint' => json_encode($this->originDimensionSpacePoint), + 'relationanchorpoint' => $this->relationAnchorPoint->value, + 'origindimensionspacepoint' => $this->originDimensionSpacePoint->toJson(), 'origindimensionspacepointhash' => $this->originDimensionSpacePoint->hash, - 'nodeaggregateid' => (string) $this->nodeAggregateId, - 'nodetypename' => (string) $this->nodeTypeName, + 'nodeaggregateid' => $this->nodeAggregateId->value, + 'nodetypename' => $this->nodeTypeName->value, 'classification' => $this->classification->value, 'properties' => json_encode($this->properties), - 'nodename' => (string) $this->nodeName + 'nodename' => $this->nodeName?->value ?? '', ]); } @@ -109,13 +109,13 @@ public function updateToDatabase(Connection $databaseConnection, string $tableNa $databaseConnection->update( $tableNamePrefix . '_node', [ - 'origindimensionspacepoint' => json_encode($this->originDimensionSpacePoint), + 'origindimensionspacepoint' => $this->originDimensionSpacePoint->toJson(), 'origindimensionspacepointhash' => $this->originDimensionSpacePoint->hash, - 'nodeaggregateid' => (string) $this->nodeAggregateId, - 'nodetypename' => (string) $this->nodeTypeName, + 'nodeaggregateid' => $this->nodeAggregateId->value, + 'nodetypename' => $this->nodeTypeName->value, 'classification' => $this->classification->value, 'properties' => json_encode($this->properties), - 'nodename' => (string) $this->nodeName, + 'nodename' => $this->nodeName?->value ?? '', ], [ 'relationanchorpoint' => $this->relationAnchorPoint @@ -129,7 +129,7 @@ public function updateToDatabase(Connection $databaseConnection, string $tableNa public function removeFromDatabase(Connection $databaseConnection, string $tableNamePrefix): void { $databaseConnection->delete($tableNamePrefix . '_node', [ - 'relationanchorpoint' => $this->relationAnchorPoint + 'relationanchorpoint' => $this->relationAnchorPoint->value ]); } } diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/ProjectionHypergraph.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/ProjectionHypergraph.php index 5d71ac3ee98..124f10c7933 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/ProjectionHypergraph.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/ProjectionHypergraph.php @@ -52,7 +52,7 @@ public function findNodeRecordByRelationAnchorPoint( WHERE n.relationanchorpoint = :relationAnchorPoint'; $parameters = [ - 'relationAnchorPoint' => (string)$relationAnchorPoint + 'relationAnchorPoint' => $relationAnchorPoint->value ]; $result = $this->getDatabaseConnection()->executeQuery($query, $parameters)->fetchAssociative(); @@ -115,9 +115,9 @@ public function findParentNodeRecordByOrigin( AND n.nodeaggregateid = :childNodeAggregateId'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, + 'contentStreamId' => $contentStreamId->value, 'originDimensionSpacePointHash' => $originDimensionSpacePoint->hash, - 'childNodeAggregateId' => (string)$childNodeAggregateId + 'childNodeAggregateId' => $childNodeAggregateId->value ]; $result = $this->getDatabaseConnection() @@ -168,9 +168,9 @@ public function findParentNodeRecordByCoverage( AND n.nodeaggregateid = :childNodeAggregateId'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, + 'contentStreamId' => $contentStreamId->value, 'coveredDimensionSpacePointHash' => $coveredDimensionSpacePoint->hash, - 'childNodeAggregateId' => (string)$childNodeAggregateId + 'childNodeAggregateId' => $childNodeAggregateId->value ]; $result = $this->getDatabaseConnection() @@ -214,8 +214,8 @@ public function findIngoingHierarchyHyperrelationRecords( WHERE h.contentstreamid = :contentStreamId AND :childNodeAnchor = ANY(h.childnodeanchors)'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, - 'childNodeAnchor' => (string)$childNodeAnchor + 'contentStreamId' => $contentStreamId->value, + 'childNodeAnchor' => $childNodeAnchor->value ]; $types = []; @@ -249,8 +249,8 @@ public function findOutgoingHierarchyHyperrelationRecords( WHERE h.contentstreamid = :contentStreamId AND h.parentnodeanchor = :parentNodeAnchor'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, - 'parentNodeAnchor' => (string)$parentNodeAnchor + 'contentStreamId' => $contentStreamId->value, + 'parentNodeAnchor' => $parentNodeAnchor->value ]; $types = []; @@ -282,7 +282,7 @@ public function findOutgoingReferenceHyperrelationRecords( WHERE r.sourcenodeanchor = :sourceNodeAnchor'; $parameters = [ - 'sourceNodeAnchor' => (string)$sourceNodeAnchor + 'sourceNodeAnchor' => $sourceNodeAnchor->value ]; $referenceHyperrelations = []; @@ -310,9 +310,9 @@ public function findHierarchyHyperrelationRecordByParentNodeAnchor( AND h.parentnodeanchor = :parentNodeAnchor'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash, - 'parentNodeAnchor' => (string)$parentNodeAnchor + 'parentNodeAnchor' => $parentNodeAnchor->value ]; $result = $this->getDatabaseConnection()->executeQuery($query, $parameters)->fetchAssociative(); @@ -337,9 +337,9 @@ public function findHierarchyHyperrelationRecordByChildNodeAnchor( AND :childNodeAnchor = ANY(h.childnodeanchors)'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash, - 'childNodeAnchor' => (string)$childNodeAnchor + 'childNodeAnchor' => $childNodeAnchor->value ]; $result = $this->getDatabaseConnection()->executeQuery($query, $parameters)->fetchAssociative(); @@ -361,7 +361,7 @@ public function findHierarchyHyperrelationRecordsByChildNodeAnchor( WHERE :childNodeAnchor = ANY(h.childnodeanchors)'; $parameters = [ - 'childNodeAnchor' => (string)$childNodeAnchor + 'childNodeAnchor' => $childNodeAnchor->value ]; $hierarchyRelationRecords = []; @@ -391,8 +391,8 @@ public function findChildHierarchyHyperrelationRecord( AND h.dimensionspacepointhash = :dimensionSpacePointHash'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, - 'nodeAggregateId' => (string)$nodeAggregateId, + 'contentStreamId' => $contentStreamId->value, + 'nodeAggregateId' => $nodeAggregateId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash ]; @@ -419,8 +419,8 @@ public function findCoverageByNodeRelationAnchorPoint( WHERE h.contentstreamid = :contentStreamId AND n.relationanchorpoint = :relationAnchorPoint'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, - 'relationanchorpoint' => (string)$nodeRelationAnchorPoint + 'contentStreamId' => $contentStreamId->value, + 'relationanchorpoint' => $nodeRelationAnchorPoint->value ]; $dimensionSpacePoints = []; @@ -449,8 +449,8 @@ public function findCoverageByNodeAggregateId( WHERE h.contentstreamid = :contentStreamId AND n.nodeaggregateid = :nodeAggregateId'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, - 'nodeAggregateId' => (string)$nodeAggregateId + 'contentStreamId' => $contentStreamId->value, + 'nodeAggregateId' => $nodeAggregateId->value ]; $dimensionSpacePoints = []; @@ -482,9 +482,9 @@ public function findOutgoingRestrictionRelations( AND r.originnodeaggregateid = :originNodeAggregateId'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHashes' => $dimensionSpacePoints->getPointHashes(), - 'originNodeAggregateId' => (string)$originNodeAggregateId + 'originNodeAggregateId' => $originNodeAggregateId->value ]; $types = [ 'dimensionSpacePointHashes' => Connection::PARAM_STR_ARRAY @@ -519,9 +519,9 @@ public function findIngoingRestrictionRelations( AND :nodeAggregateId = ANY(r.affectednodeaggregateids)'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash, - 'nodeAggregateId' => (string)$nodeAggregateId + 'nodeAggregateId' => $nodeAggregateId->value ]; $restrictionRelations = []; @@ -583,8 +583,8 @@ public function findDescendantNodeAggregateIds( SELECT nodeaggregateid, dimensionspacepointhash from descendantNodes'; $parameters = [ - 'entryNodeAggregateId' => (string)$nodeAggregateId, - 'contentStreamId' => (string)$contentStreamId, + 'entryNodeAggregateId' => $nodeAggregateId->value, + 'contentStreamId' => $contentStreamId->value, 'affectedDimensionSpacePointHashes' => $dimensionSpacePoints->getPointHashes() ]; @@ -614,7 +614,7 @@ public function countContentStreamCoverage(NodeRelationAnchorPoint $anchorPoint) WHERE :anchorPoint = ANY(childnodeanchors)'; $parameters = [ - 'anchorPoint' => (string)$anchorPoint + 'anchorPoint' => $anchorPoint->value ]; return (int)$this->getDatabaseConnection()->executeQuery($query, $parameters)->rowCount(); diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Query/ProjectionHypergraphQuery.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Query/ProjectionHypergraphQuery.php index 62f0bc566e4..53c1efacd45 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Query/ProjectionHypergraphQuery.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/Query/ProjectionHypergraphQuery.php @@ -60,7 +60,7 @@ public static function create(ContentStreamId $contentStreamId, string $tableNam WHERE h.contentstreamid = :contentStreamId'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId + 'contentStreamId' => $contentStreamId->value ]; return new self($query, $parameters, []); @@ -108,7 +108,7 @@ public function withNodeAggregateId(NodeAggregateId $nodeAggregateId): self AND n.nodeaggregateid = :nodeAggregateId'; $parameters = $this->parameters; - $parameters['nodeAggregateId'] = (string)$nodeAggregateId; + $parameters['nodeAggregateId'] = $nodeAggregateId->value; return new self($query, $parameters, $this->types); } diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/ReferenceRelationRecord.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/ReferenceRelationRecord.php index 5952daaaed1..b661e1650e8 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/ReferenceRelationRecord.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/ReferenceRelationRecord.php @@ -58,13 +58,13 @@ public static function fromDatabaseRow(array $databaseRow): self public function addToDatabase(Connection $databaseConnection, string $tableNamePrefix): void { $databaseConnection->insert($tableNamePrefix . '_referencerelation', [ - 'sourcenodeanchor' => (string)$this->sourceNodeAnchor, - 'name' => (string)$this->name, + 'sourcenodeanchor' => $this->sourceNodeAnchor->value, + 'name' => $this->name->value, 'position' => $this->position, 'properties' => $this->properties ? \json_encode($this->properties) : null, - 'targetnodeaggregateid' => (string)$this->targetNodeAggregateId + 'targetnodeaggregateid' => $this->targetNodeAggregateId->value ]); } @@ -85,7 +85,7 @@ public static function removeFromDatabaseForSource( string $tableNamePrefix ): void { $databaseConnection->delete($tableNamePrefix . '_referencerelation', [ - 'sourcenodeanchor' => $sourceNodeAnchor + 'sourcenodeanchor' => $sourceNodeAnchor->value ]); } } diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/RestrictionHyperrelationRecord.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/RestrictionHyperrelationRecord.php index 6ea7ab18535..21de777d448 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/RestrictionHyperrelationRecord.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/RestrictionHyperrelationRecord.php @@ -55,7 +55,7 @@ public static function fromDatabaseRow(array $databaseRow): self ContentStreamId::fromString($databaseRow['contentstreamid']), $databaseRow['dimensionspacepointhash'], NodeAggregateId::fromString($databaseRow['originnodeaggregateid']), - NodeAggregateIds::fromDatabaseString($databaseRow['affectednodeaggregateids']) + self::nodeAggregateIdsFromDatabaseString($databaseRow['affectednodeaggregateids']) ); } @@ -110,10 +110,10 @@ public function addToDatabase(Connection $databaseConnection, string $tableNameP ) VALUES (?, ?, ?, ?) ON CONFLICT DO NOTHING', [ - (string)$this->contentStreamId, + $this->contentStreamId->value, $this->dimensionSpacePointHash, - (string)$this->originNodeAggregateId, - $this->affectedNodeAggregateIds->toDatabaseString() + $this->originNodeAggregateId->value, + self::nodeAggregateIdsToDatabaseString($this->affectedNodeAggregateIds), ] ); } @@ -129,7 +129,7 @@ private function updateAffectedNodeAggregateIds( $databaseConnection->update( $tableNamePrefix . '_restrictionhyperrelation', [ - 'affectednodeaggregateids' => $affectedNodeAggregateIds->toDatabaseString() + 'affectednodeaggregateids' => self::nodeAggregateIdsToDatabaseString($affectedNodeAggregateIds), ], $this->getDatabaseIdentifier() ); @@ -150,9 +150,19 @@ public function removeFromDatabase(Connection $databaseConnection, string $table public function getDatabaseIdentifier(): array { return [ - 'contentstreamid' => (string)$this->contentStreamId, + 'contentstreamid' => $this->contentStreamId->value, 'dimensionspacepointhash' => $this->dimensionSpacePointHash, - 'originnodeaggregateid' => (string)$this->originNodeAggregateId + 'originnodeaggregateid' => $this->originNodeAggregateId->value ]; } + + private static function nodeAggregateIdsFromDatabaseString(string $databaseString): NodeAggregateIds + { + return NodeAggregateIds::fromArray(\explode(',', \trim($databaseString, '{}'))); + } + + private static function nodeAggregateIdsToDatabaseString(NodeAggregateIds $ids): string + { + return '{' . implode(',', array_map(static fn (NodeAggregateId $id) => $id->value, iterator_to_array($ids))) . '}'; + } } diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentHypergraph.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentHypergraph.php index 5659a4ed76f..37e130ad292 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentHypergraph.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentHypergraph.php @@ -70,7 +70,7 @@ public function getSubgraph( DimensionSpacePoint $dimensionSpacePoint, VisibilityConstraints $visibilityConstraints ): ContentSubgraphInterface { - $index = $contentStreamId . '-' . $dimensionSpacePoint->hash . '-' . $visibilityConstraints->getHash(); + $index = $contentStreamId->value . '-' . $dimensionSpacePoint->hash . '-' . $visibilityConstraints->getHash(); if (!isset($this->subhypergraphs[$index])) { $this->subhypergraphs[$index] = new ContentSubhypergraph( $contentStreamId, @@ -189,8 +189,8 @@ public function findParentNodeAggregateByChildOriginDimensionSpacePoint( AND ch.contentstreamid = :contentStreamId )'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, - 'childNodeAggregateId' => (string)$childNodeAggregateId, + 'contentStreamId' => $contentStreamId->value, + 'childNodeAggregateId' => $childNodeAggregateId->value, 'childOriginDimensionSpacePointHash' => $childOriginDimensionSpacePoint->hash ]; diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentSubhypergraph.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentSubhypergraph.php index ae9ef82dafd..3970557a4d3 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentSubhypergraph.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentSubhypergraph.php @@ -334,7 +334,7 @@ public function findSubtree( ): ?Subtree { $parameters = [ 'entryNodeAggregateId' => $entryNodeAggregateId->value, - 'contentStreamId' => (string)$this->contentStreamId, + 'contentStreamId' => $this->contentStreamId->value, 'dimensionSpacePointHash' => $this->dimensionSpacePoint->hash, 'maximumLevels' => $filter->maximumLevels ]; @@ -442,7 +442,7 @@ public function countNodes(): int AND h.dimensionspacepointhash = :dimensionSpacePointHash'; $parameters = [ - 'contentStreamId' => (string)$this->contentStreamId, + 'contentStreamId' => $this->contentStreamId->value, 'dimensionSpacePointHash' => $this->dimensionSpacePoint->hash ]; diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphChildQuery.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphChildQuery.php index 2c723259c4a..81ff62f6206 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphChildQuery.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphChildQuery.php @@ -58,8 +58,8 @@ public static function create( AND pn.nodeaggregateid = :parentNodeAggregateId'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, - 'parentNodeAggregateId' => (string)$parentNodeAggregateId + 'contentStreamId' => $contentStreamId->value, + 'parentNodeAggregateId' => $parentNodeAggregateId->value ]; return new self($query, $parameters, $tableNamePrefix); @@ -106,7 +106,7 @@ public function withChildNodeName(NodeName $childNodeName): self AND cn.nodename = :childNodeName'; $parameters = $this->parameters; - $parameters['childNodeName'] = (string)$childNodeName; + $parameters['childNodeName'] = $childNodeName->value; return new self($query, $parameters, $this->tableNamePrefix, $this->types); } diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphParentQuery.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphParentQuery.php index 7470f87b11a..d94a9da563f 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphParentQuery.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphParentQuery.php @@ -50,7 +50,7 @@ public static function create( AND ch.contentstreamid = :contentStreamId'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId + 'contentStreamId' => $contentStreamId->value ]; return new self($query, $parameters, $tableNamePrefix); @@ -62,7 +62,7 @@ public function withChildNodeAggregateId(NodeAggregateId $nodeAggregateId): self AND cn.nodeaggregateid = :nodeAggregateId'; $parameters = $this->parameters; - $parameters['nodeAggregateId'] = (string)$nodeAggregateId; + $parameters['nodeAggregateId'] = $nodeAggregateId->value; return new self($query, $parameters, $this->tableNamePrefix); } diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphQuery.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphQuery.php index fb2f121b733..18f6ad6f787 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphQuery.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphQuery.php @@ -53,7 +53,7 @@ public static function create( WHERE h.contentstreamid = :contentStreamId'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId + 'contentStreamId' => $contentStreamId->value ]; return new self($query, $parameters, $tableNamePrefix); @@ -87,7 +87,7 @@ public function withNodeAggregateId(NodeAggregateId $nodeAggregateId): self AND n.nodeaggregateid = :nodeAggregateId'; $parameters = $this->parameters; - $parameters['nodeAggregateId'] = (string)$nodeAggregateId; + $parameters['nodeAggregateId'] = $nodeAggregateId->value; return new self($query, $parameters, $this->tableNamePrefix); } diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphReferenceQuery.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphReferenceQuery.php index 5ebf4884461..fd65183ea32 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphReferenceQuery.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphReferenceQuery.php @@ -48,7 +48,7 @@ public static function create( WHERE srch.contentstreamid = :contentStreamId AND tarh.contentstreamid = :contentStreamId'; $parameters = [ - 'contentStreamId' => (string)$contentStreamId, + 'contentStreamId' => $contentStreamId->value, ]; return new self( @@ -78,7 +78,7 @@ public function withSourceNodeAggregateId(NodeAggregateId $sourceNodeAggregateId AND srcn.nodeaggregateid = :sourceNodeAggregateId'; $parameters = $this->parameters; - $parameters['sourceNodeAggregateId'] = (string)$sourceNodeAggregateId; + $parameters['sourceNodeAggregateId'] = $sourceNodeAggregateId->value; return new self($query, $parameters, $this->tableNamePrefix, $this->types); } @@ -91,7 +91,7 @@ public function withTargetNodeAggregateId( AND tarn.nodeaggregateid = :targetNodeAggregateId'; $parameters = $this->parameters; - $parameters['targetNodeAggregateId'] = (string)$targetNodeAggregateId; + $parameters['targetNodeAggregateId'] = $targetNodeAggregateId->value; return new self($query, $parameters, $this->tableNamePrefix, $this->types); } @@ -103,7 +103,7 @@ public function withReferenceName(ReferenceName $referenceName): self AND r.name = :referenceName'; $parameters = $this->parameters; - $parameters['referenceName'] = (string)$referenceName; + $parameters['referenceName'] = $referenceName->value; return new self($query, $parameters, $this->tableNamePrefix, $this->types); } diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphSiblingQuery.php b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphSiblingQuery.php index d760a7f1add..f8ee802963d 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphSiblingQuery.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/Query/HypergraphSiblingQuery.php @@ -46,9 +46,9 @@ public static function create( . $queryMode->renderCondition(); $parameters = [ - 'contentStreamId' => (string)$contentStreamId, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash, - 'nodeAggregateId' => (string)$nodeAggregateId + 'nodeAggregateId' => $nodeAggregateId->value ]; return new self($query, $parameters, $tableNamePrefix); diff --git a/Neos.ContentGraph.PostgreSQLAdapter/src/HypergraphProjectionFactory.php b/Neos.ContentGraph.PostgreSQLAdapter/src/HypergraphProjectionFactory.php index 1f6fe760f2c..28376b7512d 100644 --- a/Neos.ContentGraph.PostgreSQLAdapter/src/HypergraphProjectionFactory.php +++ b/Neos.ContentGraph.PostgreSQLAdapter/src/HypergraphProjectionFactory.php @@ -27,7 +27,7 @@ public function __construct( public static function graphProjectionTableNamePrefix( ContentRepositoryId $contentRepositoryId ): string { - return sprintf('cr_%s_p_hypergraph', $contentRepositoryId); + return sprintf('cr_%s_p_hypergraph', $contentRepositoryId->value); } public function build( diff --git a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/WorkspacePublishing/RebasingAutoCreatedNodesWorks.feature b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/WorkspacePublishing/RebasingAutoCreatedNodesWorks.feature index aabff6eb514..db0c6d8858f 100644 --- a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/WorkspacePublishing/RebasingAutoCreatedNodesWorks.feature +++ b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/WorkspacePublishing/RebasingAutoCreatedNodesWorks.feature @@ -69,7 +69,7 @@ Feature: Rebasing auto-created nodes works When the command "SetSerializedNodeProperties" is executed with payload: | Key | Value | | contentStreamId | "user-cs-identifier" | - | nodeAggregateId | $this->currentnodeAggregateId | + | nodeAggregateId | $this->currentNodeAggregateId | | originDimensionSpacePoint | {} | | propertyValues | {"text": {"value":"Modified","type":"string"}} | And the graph projection is fully up to date diff --git a/Neos.ContentRepository.Core/Classes/Dimension/ConfigurationBasedContentDimensionSource.php b/Neos.ContentRepository.Core/Classes/Dimension/ConfigurationBasedContentDimensionSource.php index 7434732d151..c353386def1 100644 --- a/Neos.ContentRepository.Core/Classes/Dimension/ConfigurationBasedContentDimensionSource.php +++ b/Neos.ContentRepository.Core/Classes/Dimension/ConfigurationBasedContentDimensionSource.php @@ -180,7 +180,7 @@ public function getDimension(ContentDimensionId $dimensionId): ?ContentDimension $this->initializeDimensions(); } - return $this->contentDimensions[(string)$dimensionId] ?? null; + return $this->contentDimensions[$dimensionId->value] ?? null; } /** diff --git a/Neos.ContentRepository.Core/Classes/Dimension/ContentDimension.php b/Neos.ContentRepository.Core/Classes/Dimension/ContentDimension.php index a05061b6a6c..f6cbeae7650 100644 --- a/Neos.ContentRepository.Core/Classes/Dimension/ContentDimension.php +++ b/Neos.ContentRepository.Core/Classes/Dimension/ContentDimension.php @@ -56,8 +56,8 @@ public function __construct( $generalizations = []; $specializations = []; foreach ($variationEdges as $variationEdge) { - $generalizations[(string)$variationEdge->specialization] = $variationEdge->generalization; - $specializations[(string)$variationEdge->generalization][(string)$variationEdge->specialization] + $generalizations[$variationEdge->specialization->value] = $variationEdge->generalization; + $specializations[$variationEdge->generalization->value][$variationEdge->specialization->value] = $variationEdge->specialization; } $this->generalizations = $generalizations; @@ -84,7 +84,7 @@ public function getRootValues(): array public function getGeneralization(ContentDimensionValue $dimensionValue): ?ContentDimensionValue { - return $this->generalizations[(string)$dimensionValue] ?? null; + return $this->generalizations[$dimensionValue->value] ?? null; } /** @@ -92,7 +92,7 @@ public function getGeneralization(ContentDimensionValue $dimensionValue): ?Conte */ public function getSpecializations(ContentDimensionValue $dimensionValue): array { - return $this->specializations[(string)$dimensionValue] ?? []; + return $this->specializations[$dimensionValue->value] ?? []; } /** diff --git a/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionConstraintSet.php b/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionConstraintSet.php index 57bf441e722..70c2786f751 100644 --- a/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionConstraintSet.php +++ b/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionConstraintSet.php @@ -65,15 +65,15 @@ public function getIterator(): \ArrayIterator public function getConstraints(ContentDimensionId $dimensionId): ?ContentDimensionConstraints { - return $this->constraints[(string)$dimensionId] ?? null; + return $this->constraints[$dimensionId->value] ?? null; } public function allowsCombinationWith( ContentDimensionId $contentDimensionId, ContentDimensionValue $contentDimensionValue ): bool { - return isset($this->constraints[(string)$contentDimensionId]) - ? $this->constraints[(string)$contentDimensionId]->allowsCombinationWith($contentDimensionValue) + return isset($this->constraints[$contentDimensionId->value]) + ? $this->constraints[$contentDimensionId->value]->allowsCombinationWith($contentDimensionValue) : true; } } diff --git a/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionConstraints.php b/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionConstraints.php index 60bb3e2cbb3..0ae753c8247 100644 --- a/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionConstraints.php +++ b/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionConstraints.php @@ -41,6 +41,6 @@ public function __construct( public function allowsCombinationWith(ContentDimensionValue $dimensionValue): bool { - return $this->identifierRestrictions[(string)$dimensionValue] ?? $this->isWildcardAllowed; + return $this->identifierRestrictions[$dimensionValue->value] ?? $this->isWildcardAllowed; } } diff --git a/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionId.php b/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionId.php index e9ed6893e52..18e5f6cd120 100644 --- a/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionId.php +++ b/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionId.php @@ -21,31 +21,26 @@ * * @api */ -final class ContentDimensionId implements \JsonSerializable, \Stringable +final class ContentDimensionId implements \JsonSerializable { /** * @throws ContentDimensionIdIsInvalid */ public function __construct( - public readonly string $id + public readonly string $value ) { - if (empty($id)) { + if (empty($value)) { throw ContentDimensionIdIsInvalid::becauseItMustNotBeEmpty(); } } public function equals(ContentDimensionId $other): bool { - return $this->id === $other->id; + return $this->value === $other->value; } public function jsonSerialize(): string { - return $this->id; - } - - public function __toString(): string - { - return $this->id; + return $this->value; } } diff --git a/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionValue.php b/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionValue.php index b849fa5bff6..480830fbdb7 100644 --- a/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionValue.php +++ b/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionValue.php @@ -22,7 +22,7 @@ * A content dimension value in a single ContentDimension; e.g. the value "de" in the dimension "language". * @api */ -final class ContentDimensionValue implements \Stringable +final class ContentDimensionValue { /** * @throws ContentDimensionValueIsInvalid @@ -64,9 +64,4 @@ public function getConfigurationValue(string $path): mixed return Arrays::getValueByPath($configuration, $path); } - - public function __toString(): string - { - return $this->value; - } } diff --git a/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionValueSpecializationDepth.php b/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionValueSpecializationDepth.php index bee487d3774..1105df5eab3 100644 --- a/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionValueSpecializationDepth.php +++ b/Neos.ContentRepository.Core/Classes/Dimension/ContentDimensionValueSpecializationDepth.php @@ -28,16 +28,16 @@ * * @internal */ -final class ContentDimensionValueSpecializationDepth implements \JsonSerializable, \Stringable +final class ContentDimensionValueSpecializationDepth implements \JsonSerializable { /** * @throws ContentDimensionValueSpecializationDepthIsInvalid */ public function __construct( - public readonly int $depth + public readonly int $value ) { - if ($depth < 0) { - throw ContentDimensionValueSpecializationDepthIsInvalid::becauseItMustBeNonNegative($depth); + if ($value < 0) { + throw ContentDimensionValueSpecializationDepthIsInvalid::becauseItMustBeNonNegative($value); } } @@ -48,31 +48,26 @@ public static function zero(): self public function isGreaterThan(ContentDimensionValueSpecializationDepth $otherDepth): bool { - return $this->depth > $otherDepth->depth; + return $this->value > $otherDepth->value; } public function isZero(): bool { - return $this->depth === 0; + return $this->value === 0; } public function increment(): self { - return new self($this->depth + 1); + return new self($this->value + 1); } public function decreaseBy(ContentDimensionValueSpecializationDepth $other): self { - return new self($this->depth - $other->depth); + return new self($this->value - $other->value); } public function jsonSerialize(): int { - return $this->depth; - } - - public function __toString(): string - { - return (string)$this->depth; + return $this->value; } } diff --git a/Neos.ContentRepository.Core/Classes/Dimension/Exception/GeneralizationIsInvalid.php b/Neos.ContentRepository.Core/Classes/Dimension/Exception/GeneralizationIsInvalid.php index 0725a1bc68f..1559312416d 100644 --- a/Neos.ContentRepository.Core/Classes/Dimension/Exception/GeneralizationIsInvalid.php +++ b/Neos.ContentRepository.Core/Classes/Dimension/Exception/GeneralizationIsInvalid.php @@ -29,8 +29,8 @@ public static function becauseComparedValueIsNoSpecialization( ContentDimensionId $dimensionId ): self { return new self( - '"' . $comparedValue . '" is no specialization of "' . $value - . '" in dimension "' . $dimensionId . '".' + '"' . $comparedValue->value . '" is no specialization of "' . $value->value + . '" in dimension "' . $dimensionId->value . '".' ); } } diff --git a/Neos.ContentRepository.Core/Classes/DimensionSpace/AbstractDimensionSpacePoint.php b/Neos.ContentRepository.Core/Classes/DimensionSpace/AbstractDimensionSpacePoint.php index 61108712a4c..8d03f3624d0 100644 --- a/Neos.ContentRepository.Core/Classes/DimensionSpace/AbstractDimensionSpacePoint.php +++ b/Neos.ContentRepository.Core/Classes/DimensionSpace/AbstractDimensionSpacePoint.php @@ -22,9 +22,7 @@ * * @api */ -abstract class AbstractDimensionSpacePoint implements - \JsonSerializable, - \Stringable +abstract class AbstractDimensionSpacePoint implements \JsonSerializable { protected function __construct( /** @@ -91,28 +89,28 @@ final public function isDirectVariantInDimension( return false; } if ( - $this->coordinates[(string)$contentDimensionId] - === $other->coordinates[(string)$contentDimensionId] + $this->coordinates[$contentDimensionId->value] + === $other->coordinates[$contentDimensionId->value] ) { return false; } $theseCoordinates = $this->coordinates; $otherCoordinates = $other->coordinates; - unset($theseCoordinates[(string)$contentDimensionId]); - unset($otherCoordinates[(string)$contentDimensionId]); + unset($theseCoordinates[$contentDimensionId->value]); + unset($otherCoordinates[$contentDimensionId->value]); return $theseCoordinates === $otherCoordinates; } final public function hasCoordinate(Dimension\ContentDimensionId $dimensionId): bool { - return isset($this->coordinates[(string)$dimensionId]); + return isset($this->coordinates[$dimensionId->value]); } final public function getCoordinate(Dimension\ContentDimensionId $dimensionId): ?string { - return $this->coordinates[(string)$dimensionId] ?? null; + return $this->coordinates[$dimensionId->value] ?? null; } /** @@ -149,7 +147,7 @@ final public function jsonSerialize(): array /** * @throws \JsonException */ - final public function __toString(): string + final public function toJson(): string { return json_encode($this, JSON_THROW_ON_ERROR); } diff --git a/Neos.ContentRepository.Core/Classes/DimensionSpace/ContentDimensionZookeeper.php b/Neos.ContentRepository.Core/Classes/DimensionSpace/ContentDimensionZookeeper.php index 9e1bcc32a8e..b8291bf08cc 100644 --- a/Neos.ContentRepository.Core/Classes/DimensionSpace/ContentDimensionZookeeper.php +++ b/Neos.ContentRepository.Core/Classes/DimensionSpace/ContentDimensionZookeeper.php @@ -44,7 +44,7 @@ protected function initializeAllowedCombinations(): void assert($contentDimension instanceof Dimension\ContentDimension); if ($dimensionCombinations === []) { foreach ($contentDimension->values as $serializedValue => $dimensionValue) { - $dimensionCombinations[] = [(string)$contentDimension->id => $dimensionValue]; + $dimensionCombinations[] = [$contentDimension->id->value => $dimensionValue]; } } else { $this->extendCombinationsWithDimension($dimensionCombinations, $contentDimension); @@ -82,7 +82,7 @@ protected function extendCombinationsWithDimension( } } $newDimensionCombination = $dimensionCombination; - $newDimensionCombination[(string)$contentDimension->id] = $currentDimensionValue; + $newDimensionCombination[$contentDimension->id->value] = $currentDimensionValue; $currentDimensionCombinations[] = $newDimensionCombination; } } @@ -111,7 +111,7 @@ public function getAllowedDimensionSubspace(): DimensionSpacePointSet foreach ($this->getAllowedCombinations() as $dimensionCombination) { $coordinates = []; foreach ($dimensionCombination as $contentDimensionId => $contentDimensionValue) { - $coordinates[$contentDimensionId] = (string)$contentDimensionValue; + $coordinates[$contentDimensionId] = $contentDimensionValue->value; } $point = DimensionSpacePoint::fromArray($coordinates); diff --git a/Neos.ContentRepository.Core/Classes/DimensionSpace/ContentSubgraphVariationWeight.php b/Neos.ContentRepository.Core/Classes/DimensionSpace/ContentSubgraphVariationWeight.php index deba8eedf58..d497e981938 100644 --- a/Neos.ContentRepository.Core/Classes/DimensionSpace/ContentSubgraphVariationWeight.php +++ b/Neos.ContentRepository.Core/Classes/DimensionSpace/ContentSubgraphVariationWeight.php @@ -30,15 +30,15 @@ * @see Dimension\ContentDimensionValueSpecializationDepth * @internal */ -final class ContentSubgraphVariationWeight implements \JsonSerializable, \Stringable +final class ContentSubgraphVariationWeight implements \JsonSerializable { public function __construct( /** * @var array */ - public readonly array $weight + public readonly array $value ) { - foreach ($weight as $dimensionId => $specializationDepth) { + foreach ($value as $dimensionId => $specializationDepth) { if (!$specializationDepth instanceof Dimension\ContentDimensionValueSpecializationDepth) { throw new \InvalidArgumentException( sprintf( @@ -54,12 +54,12 @@ public function __construct( public function getWeightInDimension( Dimension\ContentDimensionId $dimensionId ): ?Dimension\ContentDimensionValueSpecializationDepth { - return $this->weight[(string)$dimensionId] ?? null; + return $this->value[$dimensionId->value] ?? null; } public function canBeComparedTo(ContentSubgraphVariationWeight $other): bool { - return array_keys($other->weight) === array_keys($this->weight); + return array_keys($other->value) === array_keys($this->value); } /** @@ -71,7 +71,7 @@ public function decreaseBy(ContentSubgraphVariationWeight $other): ContentSubgra throw Exception\ContentSubgraphVariationWeightsAreIncomparable::butWereAttemptedTo($this, $other); } $decreasedWeight = []; - foreach ($this->weight as $rawDimensionId => $weight) { + foreach ($this->value as $rawDimensionId => $weight) { $dimensionId = new Dimension\ContentDimensionId($rawDimensionId); /** * @var Dimension\ContentDimensionValueSpecializationDepth $otherWeight @@ -87,9 +87,10 @@ public function decreaseBy(ContentSubgraphVariationWeight $other): ContentSubgra public function normalize(int $normalizationBase): int { $normalizedWeight = 0; - $exponent = count($this->weight) - 1; - foreach ($this->weight as $dimensionId => $specializationDepth) { - $normalizedWeight += pow($normalizationBase, $exponent) * $specializationDepth->depth; + $exponent = count($this->value) - 1; + /** @var Dimension\ContentDimensionValueSpecializationDepth $specializationDepth */ + foreach ($this->value as $dimensionId => $specializationDepth) { + $normalizedWeight += pow($normalizationBase, $exponent) * $specializationDepth->value; $exponent--; } @@ -101,13 +102,13 @@ public function normalize(int $normalizationBase): int */ public function jsonSerialize(): array { - return $this->weight; + return $this->value; } /** * @throws \JsonException */ - public function __toString(): string + public function toJson(): string { return json_encode($this, JSON_THROW_ON_ERROR); } diff --git a/Neos.ContentRepository.Core/Classes/DimensionSpace/DimensionSpacePoint.php b/Neos.ContentRepository.Core/Classes/DimensionSpace/DimensionSpacePoint.php index 760bb176549..aecb51fe6f1 100644 --- a/Neos.ContentRepository.Core/Classes/DimensionSpace/DimensionSpacePoint.php +++ b/Neos.ContentRepository.Core/Classes/DimensionSpace/DimensionSpacePoint.php @@ -90,7 +90,7 @@ final public static function fromUriRepresentation(string $encoded): self final public function vary(Dimension\ContentDimensionId $dimensionId, string $value): self { $variedCoordinates = $this->coordinates; - $variedCoordinates[(string)$dimensionId] = $value; + $variedCoordinates[$dimensionId->value] = $value; return self::instance($variedCoordinates); } diff --git a/Neos.ContentRepository.Core/Classes/DimensionSpace/DimensionSpacePointSet.php b/Neos.ContentRepository.Core/Classes/DimensionSpace/DimensionSpacePointSet.php index a5ccd3ac747..3b8b3165831 100644 --- a/Neos.ContentRepository.Core/Classes/DimensionSpace/DimensionSpacePointSet.php +++ b/Neos.ContentRepository.Core/Classes/DimensionSpace/DimensionSpacePointSet.php @@ -24,7 +24,6 @@ */ final class DimensionSpacePointSet implements \JsonSerializable, - \Stringable, \IteratorAggregate, \ArrayAccess, \Countable @@ -161,7 +160,7 @@ public function getIterator(): \ArrayIterator /** * @throws \JsonException */ - public function __toString(): string + public function toJson(): string { return json_encode($this, JSON_THROW_ON_ERROR); } diff --git a/Neos.ContentRepository.Core/Classes/DimensionSpace/Exception/ContentSubgraphVariationWeightsAreIncomparable.php b/Neos.ContentRepository.Core/Classes/DimensionSpace/Exception/ContentSubgraphVariationWeightsAreIncomparable.php index 05d69dd4187..67769939354 100644 --- a/Neos.ContentRepository.Core/Classes/DimensionSpace/Exception/ContentSubgraphVariationWeightsAreIncomparable.php +++ b/Neos.ContentRepository.Core/Classes/DimensionSpace/Exception/ContentSubgraphVariationWeightsAreIncomparable.php @@ -28,7 +28,7 @@ public static function butWereAttemptedTo( ContentSubgraphVariationWeight $second ): self { return new self( - 'Weights ' . $first . ' and ' . $second . ' cannot be compared.', + 'Weights ' . $first->toJson() . ' and ' . $second->toJson() . ' cannot be compared.', 1517474233 ); } diff --git a/Neos.ContentRepository.Core/Classes/DimensionSpace/Exception/DimensionSpacePointIsNoSpecialization.php b/Neos.ContentRepository.Core/Classes/DimensionSpace/Exception/DimensionSpacePointIsNoSpecialization.php index 97f38a0de31..3350ac8eaae 100644 --- a/Neos.ContentRepository.Core/Classes/DimensionSpace/Exception/DimensionSpacePointIsNoSpecialization.php +++ b/Neos.ContentRepository.Core/Classes/DimensionSpace/Exception/DimensionSpacePointIsNoSpecialization.php @@ -27,8 +27,8 @@ public static function butWasSupposedToBe(DimensionSpacePoint $target, Dimension { return new self(sprintf( 'The Dimension space point %s is no specialization of %s.', - $target, - $source + $target->toJson(), + $source->toJson() ), 1617275140); } } diff --git a/Neos.ContentRepository.Core/Classes/DimensionSpace/Exception/DimensionSpacePointNotFound.php b/Neos.ContentRepository.Core/Classes/DimensionSpace/Exception/DimensionSpacePointNotFound.php index 8e968fde590..111ab435412 100644 --- a/Neos.ContentRepository.Core/Classes/DimensionSpace/Exception/DimensionSpacePointNotFound.php +++ b/Neos.ContentRepository.Core/Classes/DimensionSpace/Exception/DimensionSpacePointNotFound.php @@ -26,7 +26,7 @@ public static function becauseItIsNotWithinTheAllowedDimensionSubspace( DimensionSpacePoint $dimensionSpacePoint ): self { return new self( - sprintf('%s was not found in the allowed dimension subspace', $dimensionSpacePoint), + sprintf('%s was not found in the allowed dimension subspace', $dimensionSpacePoint->toJson()), 1505929456 ); } diff --git a/Neos.ContentRepository.Core/Classes/DimensionSpace/InterDimensionalVariationGraph.php b/Neos.ContentRepository.Core/Classes/DimensionSpace/InterDimensionalVariationGraph.php index c777920ea16..7cc294a242a 100644 --- a/Neos.ContentRepository.Core/Classes/DimensionSpace/InterDimensionalVariationGraph.php +++ b/Neos.ContentRepository.Core/Classes/DimensionSpace/InterDimensionalVariationGraph.php @@ -139,7 +139,7 @@ protected function determineWeightNormalizationBase(): int if (is_null($this->weightNormalizationBase)) { $base = 0; foreach ($this->contentDimensionSource->getContentDimensionsOrderedByPriority() as $contentDimension) { - $base = max($base, $contentDimension->getMaximumDepth()->depth + 1); + $base = max($base, $contentDimension->getMaximumDepth()->value + 1); } $this->weightNormalizationBase = $base; @@ -169,7 +169,7 @@ protected function initializeVariations(): void $dimension = $this->contentDimensionSource->getDimension($dimensionId); foreach ($dimension->getSpecializations($contentDimensionValue) as $specializedValue) { $specializedDimensionSpacePoint = $generalization->dimensionSpacePoint - ->vary($dimensionId, (string)$specializedValue); + ->vary($dimensionId, $specializedValue->value); if ( !$this->contentDimensionZookeeper->getAllowedDimensionSubspace() ->contains($specializedDimensionSpacePoint) diff --git a/Neos.ContentRepository.Core/Classes/DimensionSpace/OriginDimensionSpacePointSet.php b/Neos.ContentRepository.Core/Classes/DimensionSpace/OriginDimensionSpacePointSet.php index d4c2abec216..c0f396b310b 100644 --- a/Neos.ContentRepository.Core/Classes/DimensionSpace/OriginDimensionSpacePointSet.php +++ b/Neos.ContentRepository.Core/Classes/DimensionSpace/OriginDimensionSpacePointSet.php @@ -116,7 +116,7 @@ public function contains(OriginDimensionSpacePoint $point): bool return isset($this->points[$point->hash]); } - public function __toString(): string + public function toJson(): string { return json_encode($this, JSON_THROW_ON_ERROR); } diff --git a/Neos.ContentRepository.Core/Classes/Factory/ContentRepositoryId.php b/Neos.ContentRepository.Core/Classes/Factory/ContentRepositoryId.php index 2394319cbc4..3fc383c9812 100644 --- a/Neos.ContentRepository.Core/Classes/Factory/ContentRepositoryId.php +++ b/Neos.ContentRepository.Core/Classes/Factory/ContentRepositoryId.php @@ -47,9 +47,4 @@ public function equals(self $other): bool { return $this->value === $other->value; } - - public function __toString(): string - { - return $this->value; - } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/Common/ConstraintChecks.php b/Neos.ContentRepository.Core/Classes/Feature/Common/ConstraintChecks.php index 307d1b67e52..b7f5161a4fe 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/Common/ConstraintChecks.php +++ b/Neos.ContentRepository.Core/Classes/Feature/Common/ConstraintChecks.php @@ -73,7 +73,7 @@ protected function requireContentStreamToExist( ): void { if (!$contentRepository->getContentStreamFinder()->hasContentStream($contentStreamId)) { throw new ContentStreamDoesNotExistYet( - 'Content stream "' . $contentStreamId . '" does not exist yet.', + 'Content stream "' . $contentStreamId->value . '" does not exist yet.', 1521386692 ); } @@ -98,10 +98,10 @@ protected function requireDimensionSpacePointToExist(DimensionSpacePoint $dimens protected function requireNodeType(NodeTypeName $nodeTypeName): NodeType { try { - return $this->getNodeTypeManager()->getNodeType((string)$nodeTypeName); + return $this->getNodeTypeManager()->getNodeType($nodeTypeName->value); } catch (NodeTypeNotFoundException $exception) { throw new NodeTypeNotFound( - 'Node type "' . $nodeTypeName . '" is unknown to the node type manager.', + 'Node type "' . $nodeTypeName->value . '" is unknown to the node type manager.', 1541671070 ); } @@ -121,7 +121,7 @@ protected function requireNodeTypeToNotBeAbstract(NodeType $nodeType): void protected function requireNodeTypeToBeOfTypeRoot(NodeType $nodeType): void { if (!$nodeType->isOfType(NodeTypeName::ROOT_NODE_TYPE_NAME)) { - throw new NodeTypeIsNotOfTypeRoot('Node type "' . $nodeType . '" is not of type root.', 1541765701); + throw new NodeTypeIsNotOfTypeRoot('Node type "' . $nodeType->name->value . '" is not of type root.', 1541765701); } } @@ -133,7 +133,7 @@ protected function requireNodeTypeToNotBeOfTypeRoot(NodeType $nodeType): void { if ($nodeType->isOfType(NodeTypeName::ROOT_NODE_TYPE_NAME)) { throw new NodeTypeIsOfTypeRoot( - 'Node type "' . $nodeType->name . '" is of type root.', + 'Node type "' . $nodeType->name->value . '" is of type root.', 1541765806 ); } @@ -159,7 +159,7 @@ protected function requireTetheredDescendantNodeTypesToNotBeOfTypeRoot(NodeType foreach ($nodeType->getAutoCreatedChildNodes() as $tetheredChildNodeType) { if ($tetheredChildNodeType->isOfType(NodeTypeName::ROOT_NODE_TYPE_NAME)) { throw new NodeTypeIsOfTypeRoot( - 'Node type "' . $nodeType->name . '" for tethered descendant is of type root.', + 'Node type "' . $nodeType->name->value . '" for tethered descendant is of type root.', 1541767062 ); } @@ -169,16 +169,16 @@ protected function requireTetheredDescendantNodeTypesToNotBeOfTypeRoot(NodeType protected function requireNodeTypeToDeclareProperty(NodeTypeName $nodeTypeName, PropertyName $propertyName): void { - $nodeType = $this->getNodeTypeManager()->getNodeType((string) $nodeTypeName); - if (!isset($nodeType->getProperties()[(string)$propertyName])) { + $nodeType = $this->getNodeTypeManager()->getNodeType($nodeTypeName->value); + if (!isset($nodeType->getProperties()[$propertyName->value])) { } } protected function requireNodeTypeToDeclareReference(NodeTypeName $nodeTypeName, ReferenceName $propertyName): void { - $nodeType = $this->getNodeTypeManager()->getNodeType((string)$nodeTypeName); - if (isset($nodeType->getProperties()[(string)$propertyName])) { - $propertyType = $nodeType->getPropertyType((string)$propertyName); + $nodeType = $this->getNodeTypeManager()->getNodeType($nodeTypeName->value); + if (isset($nodeType->getProperties()[$propertyName->value])) { + $propertyType = $nodeType->getPropertyType($propertyName->value); if ($propertyType === 'reference' || $propertyType === 'references') { return; } @@ -191,8 +191,8 @@ protected function requireNodeTypeToAllowNodesOfTypeInReference( ReferenceName $referenceName, NodeTypeName $nodeTypeNameInQuestion ): void { - $nodeType = $this->getNodeTypeManager()->getNodeType((string)$nodeTypeName); - $propertyDeclaration = $nodeType->getProperties()[(string)$referenceName] ?? null; + $nodeType = $this->getNodeTypeManager()->getNodeType($nodeTypeName->value); + $propertyDeclaration = $nodeType->getProperties()[$referenceName->value] ?? null; if (is_null($propertyDeclaration)) { throw ReferenceCannotBeSet::becauseTheNodeTypeDoesNotDeclareIt($referenceName, $nodeTypeName); } @@ -275,8 +275,8 @@ protected function requireNodeTypeConstraintsImposedByParentToBeMet( // !!! IF YOU ADJUST THIS METHOD, also adjust the method below. if (!$parentsNodeType->allowsChildNodeType($nodeType)) { throw new NodeConstraintException( - 'Node type "' . $nodeType . '" is not allowed for child nodes of type ' - . $parentsNodeType->name + 'Node type "' . $nodeType->name->value . '" is not allowed for child nodes of type ' + . $parentsNodeType->name->value ); } if ( @@ -285,10 +285,10 @@ protected function requireNodeTypeConstraintsImposedByParentToBeMet( && !$parentsNodeType->getTypeOfAutoCreatedChildNode($nodeName)?->name->equals($nodeType->name) ) { throw new NodeConstraintException( - 'Node type "' . $nodeType . '" does not match configured "' - . $parentsNodeType->getTypeOfAutoCreatedChildNode($nodeName)?->name - . '" for auto created child nodes for parent type "' . $parentsNodeType - . '" with name "' . $nodeName . '"' + 'Node type "' . $nodeType->name->value . '" does not match configured "' + . $parentsNodeType->getTypeOfAutoCreatedChildNode($nodeName)?->name->value + . '" for auto created child nodes for parent type "' . $parentsNodeType->name->value + . '" with name "' . $nodeName->value . '"' ); } } @@ -328,8 +328,8 @@ protected function requireNodeTypeConstraintsImposedByGrandparentToBeMet( ) ) { throw new NodeConstraintException( - 'Node type "' . $nodeType . '" is not allowed below tethered child nodes "' . $parentNodeName - . '" of nodes of type "' . $grandParentsNodeType->name . '"', + 'Node type "' . $nodeType->name->value . '" is not allowed below tethered child nodes "' . $parentNodeName?->value + . '" of nodes of type "' . $grandParentsNodeType->name->value . '"', 1520011791 ); } @@ -343,7 +343,7 @@ protected function areNodeTypeConstraintsImposedByGrandparentValid( if ( $parentNodeName && $grandParentsNodeType->hasAutoCreatedChildNode($parentNodeName) - && !$grandParentsNodeType->allowsGrandchildNodeType((string)$parentNodeName, $nodeType) + && !$grandParentsNodeType->allowsGrandchildNodeType($parentNodeName->value, $nodeType) ) { return false; } @@ -366,7 +366,7 @@ protected function requireProjectedNodeAggregate( if (!$nodeAggregate) { throw new NodeAggregateCurrentlyDoesNotExist( - 'Node aggregate "' . $nodeAggregateId . '" does currently not exist.', + 'Node aggregate "' . $nodeAggregateId->value . '" does currently not exist.', 1541678486 ); } @@ -390,7 +390,7 @@ protected function requireProjectedNodeAggregateToNotExist( if ($nodeAggregate) { throw new NodeAggregateCurrentlyExists( - 'Node aggregate "' . $nodeAggregateId . '" does currently exist, but should not.', + 'Node aggregate "' . $nodeAggregateId->value . '" does currently exist, but should not.', 1541687645 ); } @@ -414,9 +414,9 @@ public function requireProjectedParentNodeAggregate( if (!$parentNodeAggregate) { throw new NodeAggregateCurrentlyDoesNotExist( - 'Parent node aggregate for ' . $childNodeAggregateId - . ' does currently not exist in origin dimension space point ' . $childOriginDimensionSpacePoint - . ' and content stream ' . $contentStreamId, + 'Parent node aggregate for ' . $childNodeAggregateId->value + . ' does currently not exist in origin dimension space point ' . $childOriginDimensionSpacePoint->toJson() + . ' and content stream ' . $contentStreamId->value, 1645368685 ); } @@ -433,7 +433,7 @@ protected function requireNodeAggregateToCoverDimensionSpacePoint( ): void { if (!$nodeAggregate->coversDimensionSpacePoint($dimensionSpacePoint)) { throw new NodeAggregateDoesCurrentlyNotCoverDimensionSpacePoint( - 'Node aggregate "' . $nodeAggregate->nodeAggregateId + 'Node aggregate "' . $nodeAggregate->nodeAggregateId->value . '" does currently not cover dimension space point ' . json_encode($dimensionSpacePoint) . '.', 1541678877 @@ -464,7 +464,7 @@ protected function requireNodeAggregateToNotBeRoot(NodeAggregate $nodeAggregate, { if ($nodeAggregate->classification->isRoot()) { throw new NodeAggregateIsRoot( - 'Node aggregate "' . $nodeAggregate->nodeAggregateId . '" is classified as root ' . $extraReason, + 'Node aggregate "' . $nodeAggregate->nodeAggregateId->value . '" is classified as root ' . $extraReason, 1554586860 ); } @@ -477,7 +477,7 @@ protected function requireNodeAggregateToBeUntethered(NodeAggregate $nodeAggrega { if ($nodeAggregate->classification->isTethered()) { throw new NodeAggregateIsTethered( - 'Node aggregate "' . $nodeAggregate->nodeAggregateId . '" is classified as tethered.', + 'Node aggregate "' . $nodeAggregate->nodeAggregateId->value . '" is classified as tethered.', 1554587288 ); } @@ -494,8 +494,8 @@ protected function requireNodeAggregateToNotBeDescendant( ): void { if ($nodeAggregate->nodeAggregateId->equals($referenceNodeAggregate->nodeAggregateId)) { throw new NodeAggregateIsDescendant( - 'Node aggregate "' . $nodeAggregate->nodeAggregateId - . '" is descendant of node aggregate "' . $referenceNodeAggregate->nodeAggregateId . '"', + 'Node aggregate "' . $nodeAggregate->nodeAggregateId->value + . '" is descendant of node aggregate "' . $referenceNodeAggregate->nodeAggregateId->value . '"', 1554971124 ); } @@ -538,9 +538,9 @@ protected function requireNodeNameToBeUnoccupied( ); if (count($dimensionSpacePointsOccupiedByChildNodeName) > 0) { throw new NodeNameIsAlreadyOccupied( - 'Child node name "' . $nodeName . '" is already occupied for parent "' - . $parentNodeAggregateId . '" in dimension space points ' - . $dimensionSpacePointsOccupiedByChildNodeName + 'Child node name "' . $nodeName->value . '" is already occupied for parent "' + . $parentNodeAggregateId->value . '" in dimension space points ' + . $dimensionSpacePointsOccupiedByChildNodeName->toJson() ); } } @@ -569,9 +569,9 @@ protected function requireNodeNameToBeUncovered( ->getIntersection($dimensionSpacePointsToBeCovered); if (!$alreadyCoveredDimensionSpacePoints->isEmpty()) { throw new NodeNameIsAlreadyCovered( - 'Node name "' . $nodeName . '" is already covered in dimension space points ' - . $alreadyCoveredDimensionSpacePoints . ' by node aggregate "' - . $childNodeAggregate->nodeAggregateId . '".' + 'Node name "' . $nodeName->value . '" is already covered in dimension space points ' + . $alreadyCoveredDimensionSpacePoints->toJson() . ' by node aggregate "' + . $childNodeAggregate->nodeAggregateId->value . '".' ); } } @@ -587,7 +587,7 @@ protected function requireNodeAggregateToOccupyDimensionSpacePoint( if (!$nodeAggregate->occupiesDimensionSpacePoint($originDimensionSpacePoint)) { throw new DimensionSpacePointIsNotYetOccupied( 'Dimension space point ' . json_encode($originDimensionSpacePoint) - . ' is not yet occupied by node aggregate "' . $nodeAggregate->nodeAggregateId . '"', + . ' is not yet occupied by node aggregate "' . $nodeAggregate->nodeAggregateId->value . '"', 1552595396 ); } @@ -603,7 +603,7 @@ protected function requireNodeAggregateToNotOccupyDimensionSpacePoint( if ($nodeAggregate->occupiesDimensionSpacePoint($originDimensionSpacePoint)) { throw new DimensionSpacePointIsAlreadyOccupied( 'Dimension space point ' . json_encode($originDimensionSpacePoint) - . ' is already occupied by node aggregate "' . $nodeAggregate->nodeAggregateId . '"', + . ' is already occupied by node aggregate "' . $nodeAggregate->nodeAggregateId->value . '"', 1552595441 ); } @@ -618,7 +618,7 @@ protected function requireNodeAggregateToDisableDimensionSpacePoint( ): void { if (!$nodeAggregate->disablesDimensionSpacePoint($dimensionSpacePoint)) { throw new NodeAggregateCurrentlyDoesNotDisableDimensionSpacePoint( - 'Node aggregate "' . $nodeAggregate->nodeAggregateId + 'Node aggregate "' . $nodeAggregate->nodeAggregateId->value . '" currently does not disable dimension space point ' . json_encode($dimensionSpacePoint) . '.', 1557735431 @@ -635,7 +635,7 @@ protected function requireNodeAggregateToNotDisableDimensionSpacePoint( ): void { if ($nodeAggregate->disablesDimensionSpacePoint($dimensionSpacePoint)) { throw new NodeAggregateCurrentlyDisablesDimensionSpacePoint( - 'Node aggregate "' . $nodeAggregate->nodeAggregateId + 'Node aggregate "' . $nodeAggregate->nodeAggregateId->value . '" currently disables dimension space point ' . json_encode($dimensionSpacePoint) . '.', 1555179563 ); @@ -647,10 +647,10 @@ protected function validateReferenceProperties( PropertyValuesToWrite $referenceProperties, NodeTypeName $nodeTypeName ): void { - $nodeType = $this->nodeTypeManager->getNodeType((string)$nodeTypeName); + $nodeType = $this->nodeTypeManager->getNodeType($nodeTypeName->value); foreach ($referenceProperties->values as $propertyName => $propertyValue) { - $referencePropertyConfig = $nodeType->getProperties()[(string)$referenceName]['properties'][$propertyName] + $referencePropertyConfig = $nodeType->getProperties()[$referenceName->value]['properties'][$propertyName] ?? null; if (is_null($referencePropertyConfig)) { diff --git a/Neos.ContentRepository.Core/Classes/Feature/ContentStreamCommandHandler.php b/Neos.ContentRepository.Core/Classes/Feature/ContentStreamCommandHandler.php index ccd3e081095..ecea56a49dc 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/ContentStreamCommandHandler.php +++ b/Neos.ContentRepository.Core/Classes/Feature/ContentStreamCommandHandler.php @@ -135,7 +135,7 @@ protected function requireContentStreamToNotExistYet( ): void { if ($contentRepository->getContentStreamFinder()->hasContentStream($contentStreamId)) { throw new ContentStreamAlreadyExists( - 'Content stream "' . $contentStreamId . '" already exists.', + 'Content stream "' . $contentStreamId->value . '" already exists.', 1521386345 ); } @@ -151,7 +151,7 @@ protected function requireContentStreamToExist( ): void { if (!$contentRepository->getContentStreamFinder()->hasContentStream($contentStreamId)) { throw new ContentStreamDoesNotExistYet( - 'Content stream "' . $contentStreamId . '" does not exist yet.', + 'Content stream "' . $contentStreamId->value . '" does not exist yet.', 1521386692 ); } diff --git a/Neos.ContentRepository.Core/Classes/Feature/ContentStreamEventStreamName.php b/Neos.ContentRepository.Core/Classes/Feature/ContentStreamEventStreamName.php index 67fcd7a2068..4bda7af36d8 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/ContentStreamEventStreamName.php +++ b/Neos.ContentRepository.Core/Classes/Feature/ContentStreamEventStreamName.php @@ -24,30 +24,20 @@ */ final class ContentStreamEventStreamName { - /** - * @var string - */ - protected $eventStreamName; - public const EVENT_STREAM_NAME_PREFIX = 'ContentStream:'; - protected function __construct(string $eventStreamName) - { - $this->eventStreamName = $eventStreamName; + private function __construct( + public readonly string $value + ) { } public static function fromContentStreamId(ContentStreamId $contentStreamId): self { - return new ContentStreamEventStreamName(self::EVENT_STREAM_NAME_PREFIX . $contentStreamId); + return new ContentStreamEventStreamName(self::EVENT_STREAM_NAME_PREFIX . $contentStreamId->value); } public function getEventStreamName(): StreamName { - return StreamName::fromString($this->eventStreamName); - } - - public function __toString(): string - { - return $this->eventStreamName; + return StreamName::fromString($this->value); } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/DimensionSpaceCommandHandler.php b/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/DimensionSpaceCommandHandler.php index fe95b6b2afa..a6296468248 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/DimensionSpaceCommandHandler.php +++ b/Neos.ContentRepository.Core/Classes/Feature/DimensionSpaceAdjustment/DimensionSpaceCommandHandler.php @@ -143,8 +143,8 @@ private static function requireDimensionSpacePointToBeEmptyInContentStream( if ($subgraph->countNodes() > 0) { throw new DimensionSpacePointAlreadyExists(sprintf( 'the content stream %s already contained nodes in dimension space point %s - this is not allowed.', - $contentStreamId, - $dimensionSpacePoint + $contentStreamId->value, + $dimensionSpacePoint->toJson(), ), 1612898126); } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeAggregateCommandHandler.php b/Neos.ContentRepository.Core/Classes/Feature/NodeAggregateCommandHandler.php index f40b3436088..2896af0cd29 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeAggregateCommandHandler.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeAggregateCommandHandler.php @@ -202,22 +202,22 @@ protected function checkConstraintsImposedByAncestors( ) as $parentAggregate ) { /* @var $parentAggregate NodeAggregate */ - $parentsNodeType = $this->nodeTypeManager->getNodeType((string)$parentAggregate->nodeTypeName); + $parentsNodeType = $this->nodeTypeManager->getNodeType($parentAggregate->nodeTypeName->value); if (!$parentsNodeType->allowsChildNodeType($newNodeType)) { throw new NodeConstraintException( - 'Node type ' . $command->newNodeTypeName - . ' is not allowed below nodes of type ' . $parentAggregate->nodeTypeName + 'Node type ' . $command->newNodeTypeName->value + . ' is not allowed below nodes of type ' . $parentAggregate->nodeTypeName->value ); } if ( $nodeAggregate->nodeName && $parentsNodeType->hasAutoCreatedChildNode($nodeAggregate->nodeName) && $parentsNodeType->getTypeOfAutoCreatedChildNode($nodeAggregate->nodeName)?->name - !== (string)$command->newNodeTypeName + !== $command->newNodeTypeName->value ) { throw new NodeConstraintException( - 'Cannot change type of auto created child node' . $nodeAggregate->nodeName - . ' to ' . $command->newNodeTypeName + 'Cannot change type of auto created child node' . $nodeAggregate->nodeName->value + . ' to ' . $command->newNodeTypeName->value ); } foreach ( @@ -228,20 +228,20 @@ protected function checkConstraintsImposedByAncestors( ) { /* @var $grandParentAggregate NodeAggregate */ $grandParentsNodeType = $this->nodeTypeManager->getNodeType( - (string)$grandParentAggregate->nodeTypeName + $grandParentAggregate->nodeTypeName->value ); if ( $parentAggregate->nodeName && $grandParentsNodeType->hasAutoCreatedChildNode($parentAggregate->nodeName) && !$grandParentsNodeType->allowsGrandchildNodeType( - (string) $parentAggregate->nodeName, + $parentAggregate->nodeName->value, $newNodeType ) ) { throw new NodeConstraintException( - 'Node type "' . $command->newNodeTypeName - . '" is not allowed below auto created child nodes "' . $parentAggregate->nodeName - . '" of nodes of type "' . $grandParentAggregate->nodeTypeName . '"', + 'Node type "' . $command->newNodeTypeName->value + . '" is not allowed below auto created child nodes "' . $parentAggregate->nodeName->value + . '" of nodes of type "' . $grandParentAggregate->nodeTypeName->value . '"', 1520011791 ); } diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Dto/NodeAggregateIdsByNodePaths.php b/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Dto/NodeAggregateIdsByNodePaths.php index 8d22b442aad..b735e38114e 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Dto/NodeAggregateIdsByNodePaths.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/Dto/NodeAggregateIdsByNodePaths.php @@ -47,7 +47,7 @@ public function __construct(array $nodeAggregateIds) ); } - $this->nodeAggregateIds[(string)$nodePath] = $nodeAggregateId; + $this->nodeAggregateIds[$nodePath->value] = $nodeAggregateId; } } @@ -100,13 +100,13 @@ public function merge(self $other): self public function getNodeAggregateId(NodePath $nodePath): ?NodeAggregateId { - return $this->nodeAggregateIds[(string)$nodePath] ?? null; + return $this->nodeAggregateIds[$nodePath->value] ?? null; } public function add(NodePath $nodePath, NodeAggregateId $nodeAggregateId): self { $nodeAggregateIds = $this->nodeAggregateIds; - $nodeAggregateIds[(string)$nodePath] = $nodeAggregateId; + $nodeAggregateIds[$nodePath->value] = $nodeAggregateId; return new self($nodeAggregateIds); } diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/NodeCreation.php b/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/NodeCreation.php index 7077d2d280b..55ba8198665 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/NodeCreation.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeCreation/NodeCreation.php @@ -92,7 +92,7 @@ private function handleCreateNodeAggregateWithNode( private function deserializeDefaultProperties(NodeTypeName $nodeTypeName): PropertyValuesToWrite { - $nodeType = $this->nodeTypeManager->getNodeType((string) $nodeTypeName); + $nodeType = $this->nodeTypeManager->getNodeType($nodeTypeName->value); $defaultValues = []; foreach ($nodeType->getDefaultValuesForProperties() as $propertyName => $defaultValue) { $propertyType = PropertyType::fromNodeTypeDeclaration( @@ -121,7 +121,7 @@ private function validateProperties(?PropertyValuesToWrite $propertyValues, Node return; } - $nodeType = $this->nodeTypeManager->getNodeType((string) $nodeTypeName); + $nodeType = $this->nodeTypeManager->getNodeType($nodeTypeName->value); foreach ($propertyValues->values as $propertyName => $propertyValue) { if (!isset($nodeType->getProperties()[$propertyName])) { throw PropertyCannotBeSet::becauseTheNodeTypeDoesNotDeclareIt( @@ -299,7 +299,7 @@ private function handleTetheredChildNodes( $nodeName = NodeName::fromString($rawNodeName); $childNodePath = $nodePath ? $nodePath->appendPathSegment($nodeName) - : NodePath::fromString((string) $nodeName); + : NodePath::fromString($nodeName->value); $childNodeAggregateId = $nodeAggregateIds->getNodeAggregateId($childNodePath) ?? NodeAggregateId::create(); $initialPropertyValues = SerializedPropertyValues::defaultFromNodeType($childNodeType); @@ -370,7 +370,7 @@ protected static function populateNodeAggregateIds( $childName = NodeName::fromString($rawChildName); $childPath = $childPath ? $childPath->appendPathSegment($childName) - : NodePath::fromString((string) $childName); + : NodePath::fromString($childName->value); if (!$nodeAggregateIds->getNodeAggregateId($childPath)) { $nodeAggregateIds = $nodeAggregateIds->add( $childPath, diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeDuplication/Dto/NodeAggregateIdMapping.php b/Neos.ContentRepository.Core/Classes/Feature/NodeDuplication/Dto/NodeAggregateIdMapping.php index 4b057a9bb89..da04bac4ed2 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeDuplication/Dto/NodeAggregateIdMapping.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeDuplication/Dto/NodeAggregateIdMapping.php @@ -49,7 +49,7 @@ public function __construct(array $nodeAggregateIds) ); } - $this->nodeAggregateIds[(string)$oldNodeAggregateId] = $newNodeAggregateId; + $this->nodeAggregateIds[$oldNodeAggregateId->value] = $newNodeAggregateId; } } @@ -62,7 +62,7 @@ public static function generateForNodeSubtreeSnapshot(NodeSubtreeSnapshot $nodeS $nodeSubtreeSnapshot->walk( function (NodeSubtreeSnapshot $nodeSubtreeSnapshot) use (&$nodeAggregateIdMapping) { // here, we create new random NodeAggregateIds. - $nodeAggregateIdMapping[(string)$nodeSubtreeSnapshot->nodeAggregateId] = NodeAggregateId::create(); + $nodeAggregateIdMapping[$nodeSubtreeSnapshot->nodeAggregateId->value] = NodeAggregateId::create(); } ); @@ -85,7 +85,7 @@ public static function fromArray(array $array): self public function getNewNodeAggregateId( NodeAggregateId $oldNodeAggregateId ): ?NodeAggregateId { - return $this->nodeAggregateIds[(string)$oldNodeAggregateId] ?? null; + return $this->nodeAggregateIds[$oldNodeAggregateId->value] ?? null; } /** diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Dto/SerializedPropertyValue.php b/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Dto/SerializedPropertyValue.php index 9db3137d848..57ba6eaba4a 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Dto/SerializedPropertyValue.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeModification/Dto/SerializedPropertyValue.php @@ -58,8 +58,15 @@ public function jsonSerialize(): array ]; } - public function __toString(): string + /** + * @return array + * @throws \JsonException + */ + public function __debugInfo(): array { - return json_encode($this->value, JSON_THROW_ON_ERROR) . ' (' . $this->type . ')'; + return [ + 'type' => $this->type, + 'value' => json_encode($this->value, JSON_THROW_ON_ERROR) + ]; } } diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/ParentNodeMoveDestination.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/ParentNodeMoveDestination.php index 51264eb2e66..0ec0a1e85c8 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/ParentNodeMoveDestination.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/ParentNodeMoveDestination.php @@ -80,7 +80,7 @@ public function jsonSerialize(): array ]; } - public function __toString(): string + public function toJson(): string { return json_encode($this, JSON_THROW_ON_ERROR); } diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/SucceedingSiblingNodeMoveDestination.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/SucceedingSiblingNodeMoveDestination.php index c87455a7385..78901162a3e 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/SucceedingSiblingNodeMoveDestination.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/Dto/SucceedingSiblingNodeMoveDestination.php @@ -92,7 +92,7 @@ public function jsonSerialize(): array ]; } - public function __toString(): string + public function toJson(): string { return json_encode($this, JSON_THROW_ON_ERROR); } diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php index 8a67053ddc2..136c89a36c5 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php @@ -206,7 +206,7 @@ private function resolveNewParentAssignments( $parentNode = $contentSubgraph->findNodeById($parentId); if ($parentNode === null) { throw new \InvalidArgumentException( - 'Parent ' . $parentId . ' not found in subgraph ' . json_encode($contentSubgraph), + 'Parent ' . $parentId->value . ' not found in subgraph ' . json_encode($contentSubgraph), 1667596931 ); } @@ -247,7 +247,7 @@ private function findSibling( $parent = $contentSubgraph->findParentNode($siblingId); if (is_null($parent)) { throw new \InvalidArgumentException( - 'Parent ' . $parentId . ' not found in subgraph ' . json_encode($contentSubgraph), + 'Parent ' . $parentId->value . ' not found in subgraph ' . json_encode($contentSubgraph), 1645366837 ); } @@ -395,7 +395,7 @@ private function resolveCoverageNodeMoveMappings( $parentOfSucceedingSibling = $contentSubgraph->findParentNode($succeedingSibling->nodeAggregateId); if ($parentOfSucceedingSibling === null) { throw new \InvalidArgumentException( - 'Parent of succeeding sibling ' . $succeedingSibling->nodeAggregateId + 'Parent of succeeding sibling ' . $succeedingSibling->nodeAggregateId->value . ' not found in subgraph ' . json_encode($contentSubgraph), 1667817639 ); diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/NodeReferencing.php b/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/NodeReferencing.php index 81fde66860f..0f264e3a470 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/NodeReferencing.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeReferencing/NodeReferencing.php @@ -138,7 +138,7 @@ private function handleSetSerializedNodeReferences( } $sourceNodeType = $this->requireNodeType($sourceNodeAggregate->nodeTypeName); - $scopeDeclaration = $sourceNodeType->getProperties()[(string)$command->referenceName]['scope'] ?? ''; + $scopeDeclaration = $sourceNodeType->getProperties()[$command->referenceName->value]['scope'] ?? ''; $scope = PropertyScope::tryFrom($scopeDeclaration) ?: PropertyScope::SCOPE_NODE; $affectedOrigins = $scope->resolveAffectedOrigins( diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/NodeRemoval.php b/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/NodeRemoval.php index 3b8e45a4427..9ea43b119cc 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/NodeRemoval.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeRemoval/NodeRemoval.php @@ -103,7 +103,7 @@ protected function requireNodeAggregateNotToBeTethered(NodeAggregate $nodeAggreg { if ($nodeAggregate->classification->isTethered()) { throw new TetheredNodeAggregateCannotBeRemoved( - 'The node aggregate "' . $nodeAggregate->nodeAggregateId + 'The node aggregate "' . $nodeAggregate->nodeAggregateId->value . '" is tethered, and thus cannot be removed.', 1597753832 ); diff --git a/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/NodeTypeChange.php b/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/NodeTypeChange.php index f61f4a762e7..6db1e898724 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/NodeTypeChange.php +++ b/Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/NodeTypeChange.php @@ -207,7 +207,7 @@ private function handleChangeNodeAggregateType( ); if ($tetheredNode === null) { $tetheredNodeAggregateId = $command->tetheredDescendantNodeAggregateIds - ?->getNodeAggregateId(NodePath::fromString((string)$tetheredNodeName)) + ?->getNodeAggregateId(NodePath::fromString($tetheredNodeName->value)) ?: NodeAggregateId::create(); array_push($events, ...iterator_to_array($this->createEventsForMissingTetheredNode( $nodeAggregate, @@ -382,7 +382,7 @@ private function deleteObsoleteTetheredNodesWhenChangingNodeType( foreach ($tetheredNodeAggregates as $tetheredNodeAggregate) { /* @var $tetheredNodeAggregate NodeAggregate */ - if (!isset($expectedTetheredNodes[(string)$tetheredNodeAggregate->nodeName])) { + if ($tetheredNodeAggregate->nodeName !== null && !isset($expectedTetheredNodes[$tetheredNodeAggregate->nodeName->value])) { // this aggregate (or parts thereof) are DISALLOWED according to constraints. // We now need to find out which edges we need to remove, $dimensionSpacePointsToBeRemoved = $this->findDimensionSpacePointsConnectingParentAndChildAggregate( diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php index 4dc96ea9721..17183cad2e5 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php @@ -111,7 +111,7 @@ private function handleCreateWorkspace( if ($existingWorkspace !== null) { throw new WorkspaceAlreadyExists(sprintf( 'The workspace %s already exists', - $command->workspaceName + $command->workspaceName->value ), 1505830958921); } @@ -119,8 +119,8 @@ private function handleCreateWorkspace( if ($baseWorkspace === null) { throw new BaseWorkspaceDoesNotExist(sprintf( 'The workspace %s (base workspace of %s) does not exist', - $command->baseWorkspaceName, - $command->workspaceName + $command->baseWorkspaceName->value, + $command->workspaceName->value ), 1513890708); } @@ -144,7 +144,7 @@ private function handleCreateWorkspace( ); return new EventsToPublish( - StreamName::fromString('Workspace:' . $command->workspaceName), + StreamName::fromString('Workspace:' . $command->workspaceName->value), $events, ExpectedVersion::ANY() ); @@ -164,7 +164,7 @@ private function handleCreateRootWorkspace( if ($existingWorkspace !== null) { throw new WorkspaceAlreadyExists(sprintf( 'The workspace %s already exists', - $command->workspaceName + $command->workspaceName->value ), 1505848624450); } @@ -185,7 +185,7 @@ private function handleCreateRootWorkspace( ); return new EventsToPublish( - StreamName::fromString('Workspace:' . $command->workspaceName), + StreamName::fromString('Workspace:' . $command->workspaceName->value), $events, ExpectedVersion::ANY() ); @@ -221,7 +221,7 @@ private function handlePublishWorkspace( ) )->block(); - $streamName = StreamName::fromString('Workspace:' . $command->workspaceName); + $streamName = StreamName::fromString('Workspace:' . $command->workspaceName->value); $events = Events::with( new WorkspaceWasPublished( $command->workspaceName, @@ -272,7 +272,7 @@ private function publishContentStream( if ($event instanceof ContentStreamWasForked) { if ($contentStreamWasForkedEvent !== null) { throw new \RuntimeException( - 'Invariant violation: The content stream "' . $contentStreamId + 'Invariant violation: The content stream "' . $contentStreamId->value . '" has two forked events.', 1658740373 ); @@ -291,7 +291,7 @@ private function publishContentStream( } if ($contentStreamWasForkedEvent === null) { - throw new \RuntimeException('Invariant violation: The content stream "' . $contentStreamId + throw new \RuntimeException('Invariant violation: The content stream "' . $contentStreamId->value . '" has NO forked event.', 1658740407); } @@ -311,7 +311,7 @@ private function publishContentStream( 'The base workspace has been modified in the meantime; please rebase.' . ' Expected version %d of source content stream %s', $contentStreamWasForkedEvent->versionOfSourceContentStream->value, - $baseContentStreamId + $baseContentStreamId->value )); } } @@ -375,17 +375,17 @@ private function handleRebaseWorkspace( "The content stream %s cannot be rebased. Error with command %d (%s)" . " - see nested exception for details.\n\n The base workspace %s is at content stream %s." . "\n The full list of commands applied so far is: %s", - $workspaceContentStreamName, + $workspaceContentStreamName->value, $i, get_class($commandToRebase), - $baseWorkspace->workspaceName, - $baseWorkspace->currentContentStreamId, + $baseWorkspace->workspaceName->value, + $baseWorkspace->currentContentStreamId->value, $fullCommandListSoFar ), $e); } } - $streamName = StreamName::fromString('Workspace:' . $command->workspaceName); + $streamName = StreamName::fromString('Workspace:' . $command->workspaceName->value); // if we got so far without an Exception, we can switch the Workspace's active Content stream. if (!$rebaseStatistics->hasErrors()) { @@ -545,7 +545,7 @@ private function handlePublishIndividualNodesFromWorkspace( // 6) switch content stream to forked WS. // if we got so far without an Exception, we can switch the Workspace's active Content stream. - $streamName = StreamName::fromString('Workspace:' . $command->workspaceName); + $streamName = StreamName::fromString('Workspace:' . $command->workspaceName->value); $events = Events::with( new WorkspaceWasPartiallyPublished( $command->workspaceName, @@ -633,7 +633,7 @@ private function handleDiscardIndividualNodesFromWorkspace( // 3) switch content stream to forked WS. // if we got so far without an Exception, we can switch the Workspace's active Content stream. - $streamName = StreamName::fromString('Workspace:' . $command->workspaceName); + $streamName = StreamName::fromString('Workspace:' . $command->workspaceName->value); $events = Events::with( new WorkspaceWasPartiallyDiscarded( $command->workspaceName, @@ -686,7 +686,7 @@ private function handleDiscardWorkspace( )->block(); // if we got so far without an Exception, we can switch the Workspace's active Content stream. - $streamName = StreamName::fromString('Workspace:' . $command->workspaceName); + $streamName = StreamName::fromString('Workspace:' . $command->workspaceName->value); $events = Events::with( new WorkspaceWasDiscarded( $command->workspaceName, diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCreation/Exception/BaseWorkspaceDoesNotExist.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCreation/Exception/BaseWorkspaceDoesNotExist.php index ed461120e1e..ed3117bb0ff 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCreation/Exception/BaseWorkspaceDoesNotExist.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCreation/Exception/BaseWorkspaceDoesNotExist.php @@ -25,7 +25,7 @@ public static function butWasSupposedTo(WorkspaceName $name): self { return new self(sprintf( 'No base workspace exists for given workspace workspace %s', - $name + $name->value ), 1513924882); } } diff --git a/Neos.ContentRepository.Core/Classes/Infrastructure/Property/PropertyConverter.php b/Neos.ContentRepository.Core/Classes/Infrastructure/Property/PropertyConverter.php index ada7ea6997c..12fb9e14402 100644 --- a/Neos.ContentRepository.Core/Classes/Infrastructure/Property/PropertyConverter.php +++ b/Neos.ContentRepository.Core/Classes/Infrastructure/Property/PropertyConverter.php @@ -85,12 +85,12 @@ private function serializePropertyValue( return new SerializedPropertyValue( $propertyValue, - (string)$propertyType + $propertyType->value ); } else { // $propertyValue == null and defined in node types (we have a resolved type) // -> we want to set the $propertyName to NULL - return new SerializedPropertyValue(null, (string)$propertyType); + return new SerializedPropertyValue(null, $propertyType->value); } } @@ -104,7 +104,7 @@ public function serializeReferencePropertyValues( foreach ($propertyValuesToWrite->values as $propertyName => $propertyValue) { // reference properties are always completely overwritten, // so we don't need the node properties' unset option - $declaredType = $nodeType->getProperties()[(string)$referenceName]['properties'][$propertyName]['type']; + $declaredType = $nodeType->getProperties()[$referenceName->value]['properties'][$propertyName]['type']; $serializedPropertyValues[$propertyName] = $this->serializePropertyValue( $declaredType, diff --git a/Neos.ContentRepository.Core/Classes/Infrastructure/Property/PropertyType.php b/Neos.ContentRepository.Core/Classes/Infrastructure/Property/PropertyType.php index 5c39e4f14c8..3c329c61aad 100644 --- a/Neos.ContentRepository.Core/Classes/Infrastructure/Property/PropertyType.php +++ b/Neos.ContentRepository.Core/Classes/Infrastructure/Property/PropertyType.php @@ -218,9 +218,4 @@ public function getSerializationType(): string { return $this->value; } - - public function __toString(): string - { - return $this->value; - } } diff --git a/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php b/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php index 60322dd80fb..aa9bada35cc 100644 --- a/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php +++ b/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php @@ -405,7 +405,8 @@ public function getNodeLabelGenerator(): NodeLabelGeneratorInterface } else { // TODO /** @var NodeLabelGeneratorInterface $nodeLabelGenerator */ - $nodeLabelGenerator = $this->objectManager->get(NodeLabelGeneratorInterface::class); + $nodeLabelGenerator = $this->objectManager->get(\Neos\ContentRepositoryRegistry\NodeLabel\ExpressionBasedNodeLabelGenerator::class); + //$nodeLabelGenerator = $this->objectManager->get(NodeLabelGeneratorInterface::class); } $this->nodeLabelGenerator = $nodeLabelGenerator; } @@ -506,7 +507,7 @@ public function getAutoCreatedChildNodes(): array public function hasAutoCreatedChildNode(NodeName $nodeName): bool { $this->initialize(); - return isset($this->fullConfiguration['childNodes'][(string)$nodeName]); + return isset($this->fullConfiguration['childNodes'][$nodeName->value]); } /** @@ -514,8 +515,8 @@ public function hasAutoCreatedChildNode(NodeName $nodeName): bool */ public function getTypeOfAutoCreatedChildNode(NodeName $nodeName): ?NodeType { - return isset($this->fullConfiguration['childNodes'][(string)$nodeName]['type']) - ? $this->nodeTypeManager->getNodeType($this->fullConfiguration['childNodes'][(string)$nodeName]['type']) + return isset($this->fullConfiguration['childNodes'][$nodeName->value]['type']) + ? $this->nodeTypeManager->getNodeType($this->fullConfiguration['childNodes'][$nodeName->value]['type']) : null; } @@ -714,13 +715,4 @@ protected function setFullConfiguration(array $fullConfiguration): void { $this->fullConfiguration = $fullConfiguration; } - - /** - * Alias for name. - * @api - */ - public function __toString(): string - { - return $this->name->value; - } } diff --git a/Neos.ContentRepository.Core/Classes/NodeType/NodeTypeName.php b/Neos.ContentRepository.Core/Classes/NodeType/NodeTypeName.php index 2890cdc589f..887a952030e 100644 --- a/Neos.ContentRepository.Core/Classes/NodeType/NodeTypeName.php +++ b/Neos.ContentRepository.Core/Classes/NodeType/NodeTypeName.php @@ -19,7 +19,7 @@ * * @api */ -final class NodeTypeName implements \JsonSerializable, \Stringable +final class NodeTypeName implements \JsonSerializable { public const ROOT_NODE_TYPE_NAME = 'Neos.ContentRepository:Root'; @@ -55,9 +55,4 @@ public function jsonSerialize(): string { return $this->value; } - - public function __toString(): string - { - return $this->value; - } } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/InMemoryCache/AllChildNodesByNodeIdCache.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/InMemoryCache/AllChildNodesByNodeIdCache.php index 2caf7772cb5..ea8caed28a4 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/InMemoryCache/AllChildNodesByNodeIdCache.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/InMemoryCache/AllChildNodesByNodeIdCache.php @@ -42,7 +42,7 @@ public function add( return; } - $nodeTypeConstraintsKey = $nodeTypeConstraints !== null ? (string)$nodeTypeConstraints : '*'; + $nodeTypeConstraintsKey = $nodeTypeConstraints !== null ? $nodeTypeConstraints->toFilterString() : '*'; $this->childNodes[$parentNodeAggregateId->value][$nodeTypeConstraintsKey] = $childNodes; } @@ -54,7 +54,7 @@ public function contains( return false; } - $nodeTypeConstraintsKey = $nodeTypeConstraints !== null ? (string)$nodeTypeConstraints : '*'; + $nodeTypeConstraintsKey = $nodeTypeConstraints !== null ? $nodeTypeConstraints->toFilterString() : '*'; return isset($this->childNodes[$parentNodeAggregateId->value][$nodeTypeConstraintsKey]); } @@ -65,7 +65,7 @@ public function findChildNodes( if ($this->isEnabled === false) { return Nodes::createEmpty(); } - $nodeTypeConstraintsKey = $nodeTypeConstraints !== null ? (string)$nodeTypeConstraints : '*'; + $nodeTypeConstraintsKey = $nodeTypeConstraints !== null ? $nodeTypeConstraints->toFilterString() : '*'; return $this->childNodes[$parentNodeAggregateId->value][$nodeTypeConstraintsKey] ?? Nodes::createEmpty(); } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/InMemoryCache/NamedChildNodeByNodeIdCache.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/InMemoryCache/NamedChildNodeByNodeIdCache.php index 49c5d6ca4cd..9c2c7bbf933 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/InMemoryCache/NamedChildNodeByNodeIdCache.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/InMemoryCache/NamedChildNodeByNodeIdCache.php @@ -53,7 +53,7 @@ public function add( return; } - $this->nodes[(string)$parentNodeAggregateId][(string)$nodeName] = $node; + $this->nodes[$parentNodeAggregateId->value][$nodeName->value] = $node; } public function contains(NodeAggregateId $parentNodeAggregateId, NodeName $nodeName): bool @@ -62,7 +62,7 @@ public function contains(NodeAggregateId $parentNodeAggregateId, NodeName $nodeN return false; } - return isset($this->nodes[(string)$parentNodeAggregateId][(string)$nodeName]); + return isset($this->nodes[$parentNodeAggregateId->value][$nodeName->value]); } public function get(NodeAggregateId $parentNodeAggregateId, NodeName $nodeName): ?Node @@ -71,6 +71,6 @@ public function get(NodeAggregateId $parentNodeAggregateId, NodeName $nodeName): return null; } - return $this->nodes[(string)$parentNodeAggregateId][(string)$nodeName] ?? null; + return $this->nodes[$parentNodeAggregateId->value][$nodeName->value] ?? null; } } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/InMemoryCache/NodeByNodeAggregateIdCache.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/InMemoryCache/NodeByNodeAggregateIdCache.php index 97d83ce5609..1c0b9696474 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/InMemoryCache/NodeByNodeAggregateIdCache.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/InMemoryCache/NodeByNodeAggregateIdCache.php @@ -52,8 +52,7 @@ public function knowsAbout(NodeAggregateId $nodeAggregateId): bool return false; } - $key = (string)$nodeAggregateId; - return isset($this->nodes[$key]) || isset($this->nonExistingNodeAggregateIds[$key]); + return isset($this->nodes[$nodeAggregateId->value]) || isset($this->nonExistingNodeAggregateIds[$nodeAggregateId->value]); } public function add(NodeAggregateId $nodeAggregateId, Node $node): void @@ -62,8 +61,7 @@ public function add(NodeAggregateId $nodeAggregateId, Node $node): void return; } - $key = (string)$nodeAggregateId; - $this->nodes[$key] = $node; + $this->nodes[$nodeAggregateId->value] = $node; } public function rememberNonExistingNodeAggregateId(NodeAggregateId $nodeAggregateId): void @@ -72,8 +70,7 @@ public function rememberNonExistingNodeAggregateId(NodeAggregateId $nodeAggregat return; } - $key = (string)$nodeAggregateId; - $this->nonExistingNodeAggregateIds[$key] = true; + $this->nonExistingNodeAggregateIds[$nodeAggregateId->value] = true; } public function get(NodeAggregateId $nodeAggregateId): ?Node @@ -82,7 +79,6 @@ public function get(NodeAggregateId $nodeAggregateId): ?Node return null; } - $key = (string)$nodeAggregateId; - return $this->nodes[$key] ?? null; + return $this->nodes[$nodeAggregateId->value] ?? null; } } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/InMemoryCache/ParentNodeIdByChildNodeIdCache.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/InMemoryCache/ParentNodeIdByChildNodeIdCache.php index 63d291fefd2..a66e0ede75b 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/InMemoryCache/ParentNodeIdByChildNodeIdCache.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphWithRuntimeCaches/InMemoryCache/ParentNodeIdByChildNodeIdCache.php @@ -48,8 +48,7 @@ public function add(NodeAggregateId $childNodeAggregateId, NodeAggregateId $pare return; } - $key = (string)$childNodeAggregateId; - $this->parentNodeAggregateIds[$key] = $parentNodeAggregateId; + $this->parentNodeAggregateIds[$childNodeAggregateId->value] = $parentNodeAggregateId; } public function knowsAbout(NodeAggregateId $childNodeAggregateId): bool @@ -58,8 +57,7 @@ public function knowsAbout(NodeAggregateId $childNodeAggregateId): bool return false; } - $key = (string)$childNodeAggregateId; - return isset($this->parentNodeAggregateIds[$key]) || isset($this->nodesWithoutParentNode[$key]); + return isset($this->parentNodeAggregateIds[$childNodeAggregateId->value]) || isset($this->nodesWithoutParentNode[$childNodeAggregateId->value]); } public function rememberNonExistingParentNode(NodeAggregateId $nodeAggregateId): void @@ -68,8 +66,7 @@ public function rememberNonExistingParentNode(NodeAggregateId $nodeAggregateId): return; } - $key = (string)$nodeAggregateId; - $this->nodesWithoutParentNode[$key] = true; + $this->nodesWithoutParentNode[$nodeAggregateId->value] = true; } @@ -79,7 +76,6 @@ public function get(NodeAggregateId $childNodeAggregateId): ?NodeAggregateId return null; } - $key = (string)$childNodeAggregateId; - return $this->parentNodeAggregateIds[$key] ?? null; + return $this->parentNodeAggregateIds[$childNodeAggregateId->value] ?? null; } } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/CoverageByOrigin.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/CoverageByOrigin.php index f2ad7d3290e..e5934cb9ccd 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/CoverageByOrigin.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/CoverageByOrigin.php @@ -27,7 +27,7 @@ * @implements \IteratorAggregate * @internal no part of public APIs */ -final class CoverageByOrigin implements \IteratorAggregate, \JsonSerializable, \Stringable +final class CoverageByOrigin implements \IteratorAggregate, \JsonSerializable { /** * The actual coverage. @@ -90,7 +90,7 @@ public function jsonSerialize(): array return $this->coverage; } - public function __toString(): string + public function toJson(): string { return json_encode($this, JSON_THROW_ON_ERROR); } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/NodePath.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/NodePath.php index 045725fd23a..b01e47523ea 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/NodePath.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/NodePath.php @@ -22,26 +22,24 @@ * It describes the hierarchy path of a node to a root node in a subgraph. * @api */ -final class NodePath implements \JsonSerializable, \Stringable +final class NodePath implements \JsonSerializable { - private string $path; - - private function __construct(string $path) - { - if ($path !== '/') { - $pathParts = explode('/', ltrim($path, '/')); + private function __construct( + public readonly string $value + ) { + if ($this->value !== '/') { + $pathParts = explode('/', ltrim($this->value, '/')); foreach ($pathParts as $pathPart) { if (preg_match(NodeName::PATTERN, $pathPart) !== 1) { throw new \InvalidArgumentException(sprintf( 'The path "%s" is no valid NodePath because it contains a segment "%s"' . ' that is no valid NodeName', - $path, + $this->value, $pathPart ), 1548157108); } } } - $this->path = $path; } public static function fromString(string $path): self @@ -62,12 +60,12 @@ public static function fromPathSegments(array $pathSegments): self public function isRoot(): bool { - return $this->path === '/'; + return $this->value === '/'; } public function isAbsolute(): bool { - return strpos($this->path, '/') === 0; + return strpos($this->value, '/') === 0; } /** @@ -75,7 +73,7 @@ public function isAbsolute(): bool */ public function appendPathSegment(NodeName $nodeName): self { - return new self($this->path . '/' . $nodeName); + return new self($this->value . '/' . $nodeName->value); } /** @@ -83,11 +81,8 @@ public function appendPathSegment(NodeName $nodeName): self */ public function getParts(): array { - $pathParts = explode('/', ltrim($this->path, '/')); - - return array_map(function (string $pathPart) { - return NodeName::fromString($pathPart); - }, $pathParts); + $pathParts = explode('/', ltrim($this->value, '/')); + return array_map(static fn (string $pathPart) => NodeName::fromString($pathPart), $pathParts); } public function getDepth(): int @@ -95,7 +90,7 @@ public function getDepth(): int if (!$this->isAbsolute()) { throw new \RuntimeException(sprintf( 'Depth of relative node path "%s" cannot be determined', - $this->path + $this->value ), 1548162166); } return count($this->getParts()); @@ -103,16 +98,11 @@ public function getDepth(): int public function equals(NodePath $other): bool { - return (string) $this === (string) $other; + return $this->value === $other->value; } public function jsonSerialize(): string { - return $this->path; - } - - public function __toString(): string - { - return $this->path; + return $this->value; } } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/NodeTypeConstraints.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/NodeTypeConstraints.php index e7432a5fcf1..8709e95a734 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/NodeTypeConstraints.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/NodeTypeConstraints.php @@ -112,17 +112,17 @@ public function withAdditionalAllowedNodeType(NodeTypeName $nodeTypeName): self ); } - public function __toString(): string + public function toFilterString(): string { - $legacyParts = []; + $parts = []; foreach ($this->explicitlyDisallowedNodeTypeNames as $nodeTypeName) { - $legacyParts[] = '!' . $nodeTypeName; + $parts[] = '!' . $nodeTypeName->value; } foreach ($this->explicitlyAllowedNodeTypeNames as $nodeTypeName) { - $legacyParts[] = (string)$nodeTypeName; + $parts[] = $nodeTypeName->value; } - return implode(',', $legacyParts); + return implode(',', $parts); } } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/NodeTypeConstraintsWithSubNodeTypes.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/NodeTypeConstraintsWithSubNodeTypes.php index 75072dca566..ec6300d2f31 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/NodeTypeConstraintsWithSubNodeTypes.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/NodeTypeConstraintsWithSubNodeTypes.php @@ -138,21 +138,21 @@ public function matches(NodeTypeName $nodeTypeName): bool return $this->isWildCardAllowed; } - public function __toString(): string + public function toFilterString(): string { - $legacyParts = []; + $parts = []; if ($this->isWildCardAllowed) { - $legacyParts[] = '*'; + $parts[] = '*'; } foreach ($this->explicitlyDisallowedNodeTypeNames as $nodeTypeName) { - $legacyParts[] = '!' . $nodeTypeName; + $parts[] = '!' . $nodeTypeName->value; } foreach ($this->explicitlyAllowedNodeTypeNames as $nodeTypeName) { - $legacyParts[] = (string)$nodeTypeName; + $parts[] = $nodeTypeName->value; } - return implode(',', $legacyParts); + return implode(',', $parts); } } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Nodes.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Nodes.php index 096e9edff9a..b19bc3a95af 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Nodes.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Nodes.php @@ -130,7 +130,7 @@ private function getNodeIndex(Node $subject): int } throw new \InvalidArgumentException(sprintf( 'The node %s does not exist in this set', - $subject->nodeAggregateId + $subject->nodeAggregateId->value ), 1542901216); } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/OriginByCoverage.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/OriginByCoverage.php index 7418f141c9f..b68544f62f4 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/OriginByCoverage.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/OriginByCoverage.php @@ -26,7 +26,7 @@ * @implements \IteratorAggregate * @internal no part of public APIs */ -final class OriginByCoverage implements \IteratorAggregate, \JsonSerializable, \Stringable +final class OriginByCoverage implements \IteratorAggregate, \JsonSerializable { /** * The set of origins. @@ -98,7 +98,7 @@ public function jsonSerialize(): array return $this->origins; } - public function __toString(): string + public function toJson(): string { return json_encode($this, JSON_THROW_ON_ERROR); } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentStream/ContentStreamFinder.php b/Neos.ContentRepository.Core/Classes/Projection/ContentStream/ContentStreamFinder.php index c63036e387f..0e910653c1d 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentStream/ContentStreamFinder.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentStream/ContentStreamFinder.php @@ -185,7 +185,7 @@ public function findStateForContentStream(ContentStreamId $contentStreamId): ?st AND removed = FALSE ', [ - 'contentStreamId' => $contentStreamId->jsonSerialize() + 'contentStreamId' => $contentStreamId->value, ] )->fetchColumn(); @@ -254,7 +254,7 @@ public function findVersionForContentStream(ContentStreamId $contentStreamId): M WHERE contentStreamId = :contentStreamId ', [ - 'contentStreamId' => $contentStreamId->jsonSerialize() + 'contentStreamId' => $contentStreamId->value, ] )->fetchOne(); @@ -275,7 +275,7 @@ public function hasContentStream(ContentStreamId $contentStreamId): bool WHERE contentStreamId = :contentStreamId ', [ - 'contentStreamId' => $contentStreamId->jsonSerialize() + 'contentStreamId' => $contentStreamId->value ] )->fetchOne(); diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentStream/ContentStreamProjection.php b/Neos.ContentRepository.Core/Classes/Projection/ContentStream/ContentStreamProjection.php index 4c55a4a44f3..1a26da8206a 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentStream/ContentStreamProjection.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentStream/ContentStreamProjection.php @@ -196,7 +196,7 @@ public function getState(): ProjectionStateInterface private function whenContentStreamWasCreated(ContentStreamWasCreated $event, EventEnvelope $eventEnvelope): void { $this->getDatabaseConnection()->insert($this->tableName, [ - 'contentStreamId' => $event->contentStreamId, + 'contentStreamId' => $event->contentStreamId->value, 'version' => self::extractVersion($eventEnvelope), 'state' => ContentStreamFinder::STATE_CREATED, ]); @@ -208,7 +208,7 @@ private function whenRootWorkspaceWasCreated(RootWorkspaceWasCreated $event): vo $this->getDatabaseConnection()->update($this->tableName, [ 'state' => ContentStreamFinder::STATE_IN_USE_BY_WORKSPACE, ], [ - 'contentStreamId' => $event->newContentStreamId + 'contentStreamId' => $event->newContentStreamId->value ]); } @@ -218,16 +218,16 @@ private function whenWorkspaceWasCreated(WorkspaceWasCreated $event): void $this->getDatabaseConnection()->update($this->tableName, [ 'state' => ContentStreamFinder::STATE_IN_USE_BY_WORKSPACE, ], [ - 'contentStreamId' => $event->newContentStreamId + 'contentStreamId' => $event->newContentStreamId->value ]); } private function whenContentStreamWasForked(ContentStreamWasForked $event, EventEnvelope $eventEnvelope): void { $this->getDatabaseConnection()->insert($this->tableName, [ - 'contentStreamId' => $event->newContentStreamId, + 'contentStreamId' => $event->newContentStreamId->value, 'version' => self::extractVersion($eventEnvelope), - 'sourceContentStreamId' => $event->sourceContentStreamId, + 'sourceContentStreamId' => $event->sourceContentStreamId->value, 'state' => ContentStreamFinder::STATE_FORKED, ]); } @@ -321,7 +321,7 @@ private function whenContentStreamWasRemoved(ContentStreamWasRemoved $event, Eve 'removed' => true, 'version' => self::extractVersion($eventEnvelope), ], [ - 'contentStreamId' => $event->contentStreamId + 'contentStreamId' => $event->contentStreamId->value ]); } @@ -330,7 +330,7 @@ private function updateStateForContentStream(ContentStreamId $contentStreamId, s $this->getDatabaseConnection()->update($this->tableName, [ 'state' => $state, ], [ - 'contentStreamId' => $contentStreamId + 'contentStreamId' => $contentStreamId->value ]); } @@ -346,7 +346,7 @@ private function updateContentStreamVersion( $this->getDatabaseConnection()->update($this->tableName, [ 'version' => self::extractVersion($eventEnvelope), ], [ - 'contentStreamId' => $eventInstance->getContentStreamId() + 'contentStreamId' => $eventInstance->getContentStreamId()->value ]); } diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentStream/ContentStreamProjectionFactory.php b/Neos.ContentRepository.Core/Classes/Projection/ContentStream/ContentStreamProjectionFactory.php index 30b48d79cd4..9a9fe52cb7e 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentStream/ContentStreamProjectionFactory.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentStream/ContentStreamProjectionFactory.php @@ -47,7 +47,7 @@ public function build( $this->dbalClient, sprintf( 'cr_%s_p_%s', - $projectionFactoryDependencies->contentRepositoryId, + $projectionFactoryDependencies->contentRepositoryId->value, $projectionShortName ), ); diff --git a/Neos.ContentRepository.Core/Classes/Projection/NodeHiddenState/NodeHiddenStateFinder.php b/Neos.ContentRepository.Core/Classes/Projection/NodeHiddenState/NodeHiddenStateFinder.php index fc3cfa34b5c..2164cd7aa1e 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/NodeHiddenState/NodeHiddenStateFinder.php +++ b/Neos.ContentRepository.Core/Classes/Projection/NodeHiddenState/NodeHiddenStateFinder.php @@ -47,9 +47,9 @@ public function findHiddenState( AND nodeaggregateid = :nodeAggregateId ', [ - 'contentStreamId' => (string)$contentStreamId, + 'contentStreamId' => $contentStreamId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash, - 'nodeAggregateId' => (string)$nodeAggregateId, + 'nodeAggregateId' => $nodeAggregateId->value, ] )->fetch(); diff --git a/Neos.ContentRepository.Core/Classes/Projection/NodeHiddenState/NodeHiddenStateProjection.php b/Neos.ContentRepository.Core/Classes/Projection/NodeHiddenState/NodeHiddenStateProjection.php index f56de3ef13c..ccbe49c9f70 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/NodeHiddenState/NodeHiddenStateProjection.php +++ b/Neos.ContentRepository.Core/Classes/Projection/NodeHiddenState/NodeHiddenStateProjection.php @@ -190,8 +190,8 @@ private function whenNodeAggregateWasEnabled(NodeAggregateWasEnabled $event): vo AND dimensionspacepointhash IN (:dimensionSpacePointHashes) ', [ - 'contentStreamId' => (string)$event->contentStreamId, - 'nodeAggregateId' => (string)$event->nodeAggregateId, + 'contentStreamId' => $event->contentStreamId->value, + 'nodeAggregateId' => $event->nodeAggregateId->value, 'dimensionSpacePointHashes' => $event->affectedDimensionSpacePoints->getPointHashes() ], [ @@ -212,7 +212,7 @@ private function whenContentStreamWasForked(ContentStreamWasForked $event): void hidden ) SELECT - "' . (string)$event->newContentStreamId . '" AS contentstreamid, + "' . $event->newContentStreamId->value . '" AS contentstreamid, nodeaggregateid, dimensionspacepoint, dimensionspacepointhash, @@ -221,7 +221,7 @@ private function whenContentStreamWasForked(ContentStreamWasForked $event): void ' . $this->tableName . ' h WHERE h.contentstreamid = :sourceContentStreamId ', [ - 'sourceContentStreamId' => (string)$event->sourceContentStreamId + 'sourceContentStreamId' => $event->sourceContentStreamId->value ]); }); } @@ -242,8 +242,8 @@ private function whenDimensionSpacePointWasMoved(DimensionSpacePointWasMoved $ev [ 'originalDimensionSpacePointHash' => $event->source->hash, 'newDimensionSpacePointHash' => $event->target->hash, - 'newDimensionSpacePoint' => json_encode($event->target->jsonSerialize()), - 'contentStreamId' => (string)$event->contentStreamId + 'newDimensionSpacePoint' => $event->target->toJson(), + 'contentStreamId' => $event->contentStreamId->value ] ); }); diff --git a/Neos.ContentRepository.Core/Classes/Projection/NodeHiddenState/NodeHiddenStateProjectionFactory.php b/Neos.ContentRepository.Core/Classes/Projection/NodeHiddenState/NodeHiddenStateProjectionFactory.php index 7f4b31a8715..86aacba6ba5 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/NodeHiddenState/NodeHiddenStateProjectionFactory.php +++ b/Neos.ContentRepository.Core/Classes/Projection/NodeHiddenState/NodeHiddenStateProjectionFactory.php @@ -48,7 +48,7 @@ public function build( $this->dbalClient, sprintf( 'cr_%s_p_%s', - $projectionFactoryDependencies->contentRepositoryId, + $projectionFactoryDependencies->contentRepositoryId->value, $projectionShortName ), ); diff --git a/Neos.ContentRepository.Core/Classes/Projection/NodeHiddenState/NodeHiddenStateRecord.php b/Neos.ContentRepository.Core/Classes/Projection/NodeHiddenState/NodeHiddenStateRecord.php index dbd798e0a3c..8324162fbac 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/NodeHiddenState/NodeHiddenStateRecord.php +++ b/Neos.ContentRepository.Core/Classes/Projection/NodeHiddenState/NodeHiddenStateRecord.php @@ -72,9 +72,9 @@ public function addToDatabase(Connection $databaseConnection, string $tableName) ); } $databaseConnection->insert($tableName, [ - 'contentStreamId' => (string)$this->contentStreamId, - 'nodeAggregateId' => (string)$this->nodeAggregateId, - 'dimensionSpacePoint' => json_encode($this->dimensionSpacePoint), + 'contentStreamId' => $this->contentStreamId->value, + 'nodeAggregateId' => $this->nodeAggregateId->value, + 'dimensionSpacePoint' => $this->dimensionSpacePoint->toJson(), 'dimensionSpacePointHash' => $this->dimensionSpacePoint->hash, 'hidden' => (int)$this->hidden, ]); diff --git a/Neos.ContentRepository.Core/Classes/Projection/Workspace/Workspace.php b/Neos.ContentRepository.Core/Classes/Projection/Workspace/Workspace.php index 66c28db625b..ac4bf644a74 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/Workspace/Workspace.php +++ b/Neos.ContentRepository.Core/Classes/Projection/Workspace/Workspace.php @@ -52,7 +52,7 @@ public function __construct( */ public function isPersonalWorkspace(): bool { - return str_starts_with($this->workspaceName->name, static::PERSONAL_WORKSPACE_PREFIX); + return str_starts_with($this->workspaceName->value, static::PERSONAL_WORKSPACE_PREFIX); } /** diff --git a/Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceFinder.php b/Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceFinder.php index 806b50118a7..db8414b0875 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceFinder.php +++ b/Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceFinder.php @@ -46,11 +46,11 @@ public function findOneByName(WorkspaceName $name): ?Workspace $connection = $this->client->getConnection(); $workspaceRow = $connection->executeQuery( ' - SELECT * FROM ' . $this->tableName . ' - WHERE workspaceName = :workspaceName - ', + SELECT * FROM ' . $this->tableName . ' + WHERE workspaceName = :workspaceName + ', [ - ':workspaceName' => (string)$name + 'workspaceName' => $name->value, ] )->fetchAssociative(); @@ -78,7 +78,7 @@ public function findOneByCurrentContentStreamId( WHERE currentContentStreamId = :currentContentStreamId ', [ - ':currentContentStreamId' => (string)$contentStreamId + 'currentContentStreamId' => $contentStreamId->value ] )->fetchAssociative(); @@ -105,13 +105,13 @@ public function findByPrefix(WorkspaceName $prefix): array WHERE workspaceName LIKE :workspaceNameLike ', [ - ':workspaceNameLike' => $prefix . '%' + 'workspaceNameLike' => $prefix->value . '%' ] )->fetchAllAssociative(); foreach ($workspaceRows as $workspaceRow) { $similarlyNamedWorkspace = $this->createWorkspaceFromDatabaseRow($workspaceRow); - $result[(string)$similarlyNamedWorkspace->workspaceName] = $similarlyNamedWorkspace; + $result[$similarlyNamedWorkspace->workspaceName->value] = $similarlyNamedWorkspace; } return $result; @@ -132,13 +132,13 @@ public function findByBaseWorkspace(WorkspaceName $baseWorkspace): array WHERE baseWorkspaceName = :workspaceName ', [ - ':workspaceName' => (string)$baseWorkspace + 'workspaceName' => $baseWorkspace->value, ] )->fetchAllAssociative(); foreach ($workspaceRows as $workspaceRow) { $similarlyNamedWorkspace = $this->createWorkspaceFromDatabaseRow($workspaceRow); - $result[(string)$similarlyNamedWorkspace->workspaceName] = $similarlyNamedWorkspace; + $result[$similarlyNamedWorkspace->workspaceName->value] = $similarlyNamedWorkspace; } return $result; @@ -153,7 +153,7 @@ public function findOneByWorkspaceOwner(string $owner): ?Workspace WHERE workspaceOwner = :workspaceOwner ', [ - ':workspaceOwner' => $owner + 'workspaceOwner' => $owner ] )->fetchAssociative(); @@ -177,7 +177,7 @@ public function findAll(): Workspaces foreach ($workspaceRows as $workspaceRow) { $similarlyNamedWorkspace = $this->createWorkspaceFromDatabaseRow($workspaceRow); - $result[(string)$similarlyNamedWorkspace->workspaceName] = $similarlyNamedWorkspace; + $result[$similarlyNamedWorkspace->workspaceName->value] = $similarlyNamedWorkspace; } return Workspaces::fromArray($result); @@ -204,7 +204,7 @@ public function findOutdated(): array foreach ($workspaceRows as $workspaceRow) { $similarlyNamedWorkspace = $this->createWorkspaceFromDatabaseRow($workspaceRow); - $result[(string)$similarlyNamedWorkspace->workspaceName] = $similarlyNamedWorkspace; + $result[$similarlyNamedWorkspace->workspaceName->value] = $similarlyNamedWorkspace; } return $result; diff --git a/Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceProjection.php b/Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceProjection.php index f2c289209ee..c783dddd896 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceProjection.php +++ b/Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceProjection.php @@ -196,12 +196,12 @@ public function markStale(): void private function whenWorkspaceWasCreated(WorkspaceWasCreated $event): void { $this->getDatabaseConnection()->insert($this->tableName, [ - 'workspaceName' => $event->workspaceName, - 'baseWorkspaceName' => $event->baseWorkspaceName, - 'workspaceTitle' => $event->workspaceTitle, - 'workspaceDescription' => $event->workspaceDescription, - 'workspaceOwner' => $event->workspaceOwner, - 'currentContentStreamId' => $event->newContentStreamId, + 'workspaceName' => $event->workspaceName->value, + 'baseWorkspaceName' => $event->baseWorkspaceName->value, + 'workspaceTitle' => $event->workspaceTitle->value, + 'workspaceDescription' => $event->workspaceDescription->value, + 'workspaceOwner' => $event->workspaceOwner?->value, + 'currentContentStreamId' => $event->newContentStreamId->value, 'status' => WorkspaceStatus::UP_TO_DATE->value ]); } @@ -209,10 +209,10 @@ private function whenWorkspaceWasCreated(WorkspaceWasCreated $event): void private function whenRootWorkspaceWasCreated(RootWorkspaceWasCreated $event): void { $this->getDatabaseConnection()->insert($this->tableName, [ - 'workspaceName' => $event->workspaceName, - 'workspaceTitle' => $event->workspaceTitle, - 'workspaceDescription' => $event->workspaceDescription, - 'currentContentStreamId' => $event->newContentStreamId, + 'workspaceName' => $event->workspaceName->value, + 'workspaceTitle' => $event->workspaceTitle->value, + 'workspaceDescription' => $event->workspaceDescription->value, + 'currentContentStreamId' => $event->newContentStreamId->value, 'status' => WorkspaceStatus::UP_TO_DATE->value ]); } @@ -282,9 +282,9 @@ private function updateContentStreamId( WorkspaceName $workspaceName ): void { $this->getDatabaseConnection()->update($this->tableName, [ - 'currentContentStreamId' => $contentStreamId + 'currentContentStreamId' => $contentStreamId->value, ], [ - 'workspaceName' => $workspaceName + 'workspaceName' => $workspaceName->value ]); } @@ -297,7 +297,7 @@ private function markWorkspaceAsUpToDate(WorkspaceName $workspaceName): void workspacename = :workspaceName ', [ 'upToDate' => WorkspaceStatus::UP_TO_DATE->value, - 'workspaceName' => $workspaceName->jsonSerialize() + 'workspaceName' => $workspaceName->value ]); } @@ -310,7 +310,7 @@ private function markDependentWorkspacesAsOutdated(WorkspaceName $baseWorkspaceN baseworkspacename = :baseWorkspaceName ', [ 'outdated' => WorkspaceStatus::OUTDATED->value, - 'baseWorkspaceName' => $baseWorkspaceName->jsonSerialize() + 'baseWorkspaceName' => $baseWorkspaceName->value ]); } @@ -324,7 +324,7 @@ private function markWorkspaceAsOutdatedConflict(WorkspaceName $workspaceName): workspacename = :workspaceName ', [ 'outdatedConflict' => WorkspaceStatus::OUTDATED_CONFLICT->value, - 'workspaceName' => $workspaceName->jsonSerialize() + 'workspaceName' => $workspaceName->value ]); } diff --git a/Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceProjectionFactory.php b/Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceProjectionFactory.php index 0babe13f3eb..ee39489e6cd 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceProjectionFactory.php +++ b/Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceProjectionFactory.php @@ -47,7 +47,7 @@ public function build( $this->dbalClient, sprintf( 'cr_%s_p_%s', - $projectionFactoryDependencies->contentRepositoryId, + $projectionFactoryDependencies->contentRepositoryId->value, $projectionShortName ), ); diff --git a/Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceRuntimeCache.php b/Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceRuntimeCache.php index 87969063dae..5db459a2fff 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceRuntimeCache.php +++ b/Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceRuntimeCache.php @@ -48,8 +48,8 @@ public function disableCache(): void public function getWorkspaceByName(WorkspaceName $name): ?Workspace { - if ($this->cacheEnabled === true && isset($this->cachedWorkspacesByName[(string)$name])) { - return $this->cachedWorkspacesByName[(string)$name]; + if ($this->cacheEnabled === true && isset($this->cachedWorkspacesByName[$name->value])) { + return $this->cachedWorkspacesByName[$name->value]; } return null; } @@ -57,7 +57,7 @@ public function getWorkspaceByName(WorkspaceName $name): ?Workspace public function setWorkspace(Workspace $workspace): void { if ($this->cacheEnabled === true) { - $this->cachedWorkspacesByName[$workspace->workspaceName->name] = $workspace; + $this->cachedWorkspacesByName[$workspace->workspaceName->value] = $workspace; $this->cachedWorkspacesByContentStreamId[ $workspace->currentContentStreamId->value ] = $workspace; @@ -68,9 +68,9 @@ public function getByCurrentContentStreamId(ContentStreamId $contentStreamId): ? { if ( $this->cacheEnabled === true - && isset($this->cachedWorkspacesByContentStreamId[(string)$contentStreamId]) + && isset($this->cachedWorkspacesByContentStreamId[$contentStreamId->value]) ) { - return $this->cachedWorkspacesByContentStreamId[(string)$contentStreamId]; + return $this->cachedWorkspacesByContentStreamId[$contentStreamId->value]; } return null; } diff --git a/Neos.ContentRepository.Core/Classes/Projection/Workspace/Workspaces.php b/Neos.ContentRepository.Core/Classes/Projection/Workspace/Workspaces.php index c804282ed1e..9abddaec49e 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/Workspace/Workspaces.php +++ b/Neos.ContentRepository.Core/Classes/Projection/Workspace/Workspaces.php @@ -44,7 +44,7 @@ private function __construct(iterable $collection) 1677833509 ); } - $workspaces[$item->workspaceName->name] = $item; + $workspaces[$item->workspaceName->value] = $item; } $this->workspaces = $workspaces; @@ -65,7 +65,7 @@ public static function createEmpty(): self public function get(WorkspaceName $workspaceName): ?Workspace { - return $this->workspaces[$workspaceName->name] ?? null; + return $this->workspaces[$workspaceName->value] ?? null; } /** diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeAggregateDoesCurrentlyNotCoverDimensionSpacePoint.php b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeAggregateDoesCurrentlyNotCoverDimensionSpacePoint.php index d2d975d6667..22b5d218c99 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeAggregateDoesCurrentlyNotCoverDimensionSpacePoint.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeAggregateDoesCurrentlyNotCoverDimensionSpacePoint.php @@ -30,8 +30,8 @@ public static function butWasSupposedTo( DimensionSpacePoint $coveredDimensionSpacePoint ): self { return new self( - 'Node aggregate "' . $nodeAggregateId - . '" does currently not cover dimension space point ' . $coveredDimensionSpacePoint, + 'Node aggregate "' . $nodeAggregateId->value + . '" does currently not cover dimension space point ' . $coveredDimensionSpacePoint->toJson(), 1554902892 ); } diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeAggregateDoesCurrentlyNotCoverDimensionSpacePointSet.php b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeAggregateDoesCurrentlyNotCoverDimensionSpacePointSet.php index 246d8debf68..fa02abbbe74 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeAggregateDoesCurrentlyNotCoverDimensionSpacePointSet.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeAggregateDoesCurrentlyNotCoverDimensionSpacePointSet.php @@ -31,8 +31,8 @@ public static function butWasSupposedTo( DimensionSpacePointSet $actualDimensionSpacePointSet ): NodeAggregateDoesCurrentlyNotCoverDimensionSpacePointSet { return new self( - 'Node aggregate "' . $nodeAggregateId . '" does not cover expected dimension space point set ' - . $expectedCoveredDimensionSpacePointSet . ' but ' . $actualDimensionSpacePointSet . '.', + 'Node aggregate "' . $nodeAggregateId->value . '" does not cover expected dimension space point set ' + . $expectedCoveredDimensionSpacePointSet->toJson() . ' but ' . $actualDimensionSpacePointSet->toJson() . '.', 1571134743 ); } diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeAggregateDoesCurrentlyNotOccupyDimensionSpacePoint.php b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeAggregateDoesCurrentlyNotOccupyDimensionSpacePoint.php index 1d95ca22fb8..a46f6444695 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeAggregateDoesCurrentlyNotOccupyDimensionSpacePoint.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeAggregateDoesCurrentlyNotOccupyDimensionSpacePoint.php @@ -30,8 +30,8 @@ public static function butWasSupposedTo( OriginDimensionSpacePoint $occupiedDimensionSpacePoint ): self { return new self( - 'Node aggregate "' . $nodeAggregateId - . '" does currently not occupy dimension space point ' . $occupiedDimensionSpacePoint, + 'Node aggregate "' . $nodeAggregateId->value + . '" does currently not occupy dimension space point ' . $occupiedDimensionSpacePoint->toJson(), 1554902613 ); } diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeTypeIsAbstract.php b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeTypeIsAbstract.php index 0b50a71ef1f..c230f290eaa 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeTypeIsAbstract.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/NodeTypeIsAbstract.php @@ -23,6 +23,6 @@ final class NodeTypeIsAbstract extends \DomainException { public static function butWasNotSupposedToBe(NodeTypeName $nodeTypeName): self { - return new self('Given node type "' . $nodeTypeName . '" is abstract.', 1630061720); + return new self('Given node type "' . $nodeTypeName->value . '" is abstract.', 1630061720); } } diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/PropertyCannotBeSet.php b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/PropertyCannotBeSet.php index e833635c8d2..8b2c1937c93 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/PropertyCannotBeSet.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/PropertyCannotBeSet.php @@ -30,7 +30,7 @@ public static function becauseTheValueDoesNotMatchTheConfiguredType( string $configuredType ): self { return new self( - 'Property "' . $propertyName . '" cannot be set to a value of type "' . $attemptedType + 'Property "' . $propertyName->value . '" cannot be set to a value of type "' . $attemptedType . '", must be of type "' . $configuredType . '".', 1615466573 ); @@ -41,8 +41,8 @@ public static function becauseTheNodeTypeDoesNotDeclareIt( NodeTypeName $nodeTypeName ): self { return new self( - 'Property "' . $propertyName . '" cannot be set because node type "' - . $nodeTypeName . '" does not declare it.', + 'Property "' . $propertyName->value . '" cannot be set because node type "' + . $nodeTypeName->value . '" does not declare it.', 1615664798 ); } diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/PropertyTypeIsInvalid.php b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/PropertyTypeIsInvalid.php index a520de42c91..8b5c241e063 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/PropertyTypeIsInvalid.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/PropertyTypeIsInvalid.php @@ -27,8 +27,8 @@ final class PropertyTypeIsInvalid extends \DomainException public static function becauseItIsReference(PropertyName $propertyName, NodeTypeName $nodeTypeName): self { return new self( - 'Given property "' . $propertyName . '" is declared as "reference" in node type "' - . $nodeTypeName . '" and must be treated as such.', + 'Given property "' . $propertyName->value . '" is declared as "reference" in node type "' + . $nodeTypeName->value . '" and must be treated as such.', 1630063201 ); } @@ -39,8 +39,8 @@ public static function becauseItIsUndefined( NodeTypeName $nodeTypeName ): self { return new self( - 'Given property "' . $propertyName . '" is declared as undefined type "' . $declaredType - . '" in node type "' . $nodeTypeName . '"', + 'Given property "' . $propertyName->value . '" is declared as undefined type "' . $declaredType + . '" in node type "' . $nodeTypeName->value . '"', 1630063406 ); } diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/ReferenceCannotBeSet.php b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/ReferenceCannotBeSet.php index ab7d61a50d2..47929baa74e 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/ReferenceCannotBeSet.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/ReferenceCannotBeSet.php @@ -30,8 +30,8 @@ public static function becauseTheNodeTypeDoesNotDeclareIt( NodeTypeName $nodeTypeName ): self { return new self( - 'Reference "' . $propertyName . '" cannot be set because node type "' - . $nodeTypeName . '" does not declare it.', + 'Reference "' . $propertyName->value . '" cannot be set because node type "' + . $nodeTypeName->value . '" does not declare it.', 1618670106 ); } @@ -42,8 +42,8 @@ public static function becauseTheConstraintsAreNotMatched( NodeTypeName $nameOfAttemptedType ): self { return new self( - 'Reference "' . $referenceName . '" cannot be set for node type "' - . $nodeTypeName . '" because the constraints do not allow nodes of type "' . $nameOfAttemptedType . '"', + 'Reference "' . $referenceName->value . '" cannot be set for node type "' + . $nodeTypeName->value . '" because the constraints do not allow nodes of type "' . $nameOfAttemptedType->value . '"', 1648502149 ); } @@ -54,8 +54,8 @@ public static function becauseTheItDoesNotDeclareAProperty( PropertyName $propertyName ): self { return new self( - 'Reference "' . $referenceName . '" cannot be set for node type "' - . $nodeTypeName . '" because it does not declare given property "' . $propertyName . '"', + 'Reference "' . $referenceName->value . '" cannot be set for node type "' + . $nodeTypeName->value . '" because it does not declare given property "' . $propertyName->value . '"', 1658406662 ); } @@ -68,8 +68,8 @@ public static function becauseAPropertyDoesNotMatchTheDeclaredType( string $configuredType ): self { return new self( - 'Reference "' . $referenceName . '" cannot be set for node type "' . $nodeTypeName - . '" because its property "' . $propertyName . '" cannot be set to a value of type "' . $attemptedType + 'Reference "' . $referenceName->value . '" cannot be set for node type "' . $nodeTypeName->value + . '" because its property "' . $propertyName->value . '" cannot be set to a value of type "' . $attemptedType . '", must be of type "' . $configuredType . '".', 1658406762 ); diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/WorkspaceDoesNotExist.php b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/WorkspaceDoesNotExist.php index 2d3da324d54..3def569da87 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/WorkspaceDoesNotExist.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/WorkspaceDoesNotExist.php @@ -25,7 +25,7 @@ public static function butWasSupposedTo(WorkspaceName $name): self { return new self(sprintf( 'The source workspace %s does not exist', - $name + $name->value ), 1513924741); } } diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/WorkspaceHasNoBaseWorkspaceName.php b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/WorkspaceHasNoBaseWorkspaceName.php index 5d1d6689219..b75479af816 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Exception/WorkspaceHasNoBaseWorkspaceName.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Exception/WorkspaceHasNoBaseWorkspaceName.php @@ -25,7 +25,7 @@ public static function butWasSupposedTo(WorkspaceName $name): self { return new self(sprintf( 'The workspace %s has no base workspace name.', - $name + $name->value ), 1645381818); } } diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeAggregateId.php b/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeAggregateId.php index a6714f90b95..b4463c93862 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeAggregateId.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeAggregateId.php @@ -21,7 +21,7 @@ * * @api */ -final class NodeAggregateId implements \JsonSerializable, \Stringable +final class NodeAggregateId implements \JsonSerializable { /** * A preg pattern to match against node aggregate identifiers @@ -59,9 +59,4 @@ public function jsonSerialize(): string { return $this->value; } - - public function __toString(): string - { - return $this->value; - } } diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeAggregateIds.php b/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeAggregateIds.php index 8baaa44dc14..66a8016be69 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeAggregateIds.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeAggregateIds.php @@ -60,7 +60,7 @@ public static function fromArray(array $array): self $nodeAggregateIds = []; foreach ($array as $serializedNodeAggregateId) { if ($serializedNodeAggregateId instanceof NodeAggregateId) { - $nodeAggregateIds[(string)$serializedNodeAggregateId] = $serializedNodeAggregateId; + $nodeAggregateIds[$serializedNodeAggregateId->value] = $serializedNodeAggregateId; } else { $nodeAggregateIds[$serializedNodeAggregateId] = NodeAggregateId::fromString($serializedNodeAggregateId); } @@ -100,7 +100,7 @@ public function jsonSerialize(): array return $this->nodeAggregateIds; } - public function __toString(): string + public function toJson(): string { return \json_encode($this, JSON_THROW_ON_ERROR); } diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeName.php b/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeName.php index ce5623de5ea..a2222b48ee7 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeName.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Node/NodeName.php @@ -22,16 +22,16 @@ * * @api */ -final class NodeName implements \JsonSerializable, \Stringable +final class NodeName implements \JsonSerializable { public const PATTERN = '/^[a-z0-9\-]+$/'; private function __construct( - private string $value + public readonly string $value ) { - if (preg_match(self::PATTERN, $value) !== 1) { + if (preg_match(self::PATTERN, $this->value) !== 1) { throw new \InvalidArgumentException( - 'Invalid node name "' . $value + 'Invalid node name "' . $this->value . '" (a node name must only contain lowercase characters, numbers and the "-" sign).', 1364290748 ); @@ -48,11 +48,6 @@ public function jsonSerialize(): string return $this->value; } - public function __toString(): string - { - return $this->value; - } - public function equals(NodeName $other): bool { return $this->value === $other->value; diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Node/PropertyName.php b/Neos.ContentRepository.Core/Classes/SharedModel/Node/PropertyName.php index 53dd15bba5a..d97e7288c28 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Node/PropertyName.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Node/PropertyName.php @@ -17,7 +17,7 @@ /** * @api */ -final class PropertyName implements \JsonSerializable, \Stringable +final class PropertyName implements \JsonSerializable { private function __construct( public readonly string $value @@ -36,9 +36,4 @@ public function jsonSerialize(): string { return $this->value; } - - public function __toString(): string - { - return $this->value; - } } diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Node/ReferenceName.php b/Neos.ContentRepository.Core/Classes/SharedModel/Node/ReferenceName.php index 0e2371a12b9..4b382b0b1f3 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Node/ReferenceName.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Node/ReferenceName.php @@ -17,7 +17,7 @@ /** * @api */ -final class ReferenceName implements \JsonSerializable, \Stringable +final class ReferenceName implements \JsonSerializable { private function __construct( public readonly string $value @@ -36,9 +36,4 @@ public function jsonSerialize(): string { return $this->value; } - - public function __toString(): string - { - return $this->value; - } } diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/User/UserId.php b/Neos.ContentRepository.Core/Classes/SharedModel/User/UserId.php index 402b440e05a..aa781ed3f22 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/User/UserId.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/User/UserId.php @@ -19,7 +19,7 @@ /** * @api */ -final class UserId implements \JsonSerializable, \Stringable +final class UserId implements \JsonSerializable { private const SYSTEM_USER_ID = 'system'; @@ -70,9 +70,4 @@ public function jsonSerialize(): string { return $this->value; } - - public function __toString(): string - { - return $this->value; - } } diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/ContentStreamId.php b/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/ContentStreamId.php index 0f0fead3b94..08ebd162b2a 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/ContentStreamId.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/ContentStreamId.php @@ -22,7 +22,7 @@ * * @api */ -final class ContentStreamId implements \JsonSerializable, \Stringable +final class ContentStreamId implements \JsonSerializable { /** * @var array @@ -54,11 +54,6 @@ public function jsonSerialize(): string return $this->value; } - public function __toString(): string - { - return $this->value; - } - public function equals(self $other): bool { return $this === $other; diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/WorkspaceDescription.php b/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/WorkspaceDescription.php index 911bb6c2e6e..96ee17b56cc 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/WorkspaceDescription.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/WorkspaceDescription.php @@ -19,16 +19,14 @@ * * @api */ -final class WorkspaceDescription implements \JsonSerializable, \Stringable +final class WorkspaceDescription implements \JsonSerializable { - protected string $description; - - public function __construct(string $description) - { - if (preg_match('/^[\p{L}\p{P}\d \.]{0,500}$/u', $description) !== 1) { + public function __construct( + public readonly string $value, + ) { + if (preg_match('/^[\p{L}\p{P}\d \.]{0,500}$/u', $this->value) !== 1) { throw new \InvalidArgumentException('Invalid workspace description given.', 1505831660363); } - $this->description = $description; } public static function fromString(string $value): self @@ -36,13 +34,8 @@ public static function fromString(string $value): self return new self($value); } - public function __toString(): string - { - return $this->description; - } - public function jsonSerialize(): string { - return $this->description; + return $this->value; } } diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/WorkspaceName.php b/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/WorkspaceName.php index 1d0a8c29c79..4870ad02165 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/WorkspaceName.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/WorkspaceName.php @@ -19,7 +19,7 @@ * * @api */ -final class WorkspaceName implements \JsonSerializable, \Stringable +final class WorkspaceName implements \JsonSerializable { public const WORKSPACE_NAME_LIVE = 'live'; @@ -29,9 +29,9 @@ final class WorkspaceName implements \JsonSerializable, \Stringable private static array $instances = []; private function __construct( - public readonly string $name + public readonly string $value ) { - if (preg_match('/^[\p{L}\p{P}\d \.]{1,200}$/u', $name) !== 1) { + if (preg_match('/^[\p{L}\p{P}\d \.]{1,200}$/u', $value) !== 1) { throw new \InvalidArgumentException('Invalid workspace name given.', 1505826610318); } } @@ -53,16 +53,16 @@ public static function forLive(): self public function isLive(): bool { - return $this->name === self::WORKSPACE_NAME_LIVE; + return $this->value === self::WORKSPACE_NAME_LIVE; } - public function __toString(): string + public function jsonSerialize(): string { - return $this->name; + return $this->value; } - public function jsonSerialize(): string + public function equals(self $other): bool { - return $this->name; + return $this === $other; } } diff --git a/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/WorkspaceTitle.php b/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/WorkspaceTitle.php index 68268a75e1a..f843c15aeca 100644 --- a/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/WorkspaceTitle.php +++ b/Neos.ContentRepository.Core/Classes/SharedModel/Workspace/WorkspaceTitle.php @@ -21,14 +21,12 @@ */ final class WorkspaceTitle implements \JsonSerializable { - protected string $title; - - public function __construct(string $title) - { - if (preg_match('/^[\p{L}\p{P}\d \.]{1,200}$/u', $title) !== 1) { + public function __construct( + public readonly string $value + ) { + if (preg_match('/^[\p{L}\p{P}\d \.]{1,200}$/u', $this->value) !== 1) { throw new \InvalidArgumentException('Invalid workspace title given.', 1505827170288); } - $this->title = $title; } public static function fromString(string $value): self @@ -36,13 +34,13 @@ public static function fromString(string $value): self return new self($value); } - public function __toString(): string + public function jsonSerialize(): string { - return $this->title; + return $this->value; } - public function jsonSerialize(): string + public function equals(self $other): bool { - return $this->title; + return $this->value === $other->value; } } diff --git a/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/CurrentSubgraphTrait.php b/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/CurrentSubgraphTrait.php index 0ebcc41e9d2..0999c8cf630 100644 --- a/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/CurrentSubgraphTrait.php +++ b/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/CurrentSubgraphTrait.php @@ -76,7 +76,7 @@ public function iAmInTheActiveContentStreamOfWorkspaceAndDimensionSpacePoint(str $workspaceName = WorkspaceName::fromString($workspaceName); $workspace = $this->getWorkspaceFinder()->findOneByName($workspaceName); if ($workspace === null) { - throw new \Exception(sprintf('Workspace "%s" does not exist, projection not yet up to date?', $workspaceName), 1548149355); + throw new \Exception(sprintf('Workspace "%s" does not exist, projection not yet up to date?', $workspaceName->value), 1548149355); } $this->contentStreamId = $workspace->currentContentStreamId; $this->dimensionSpacePoint = DimensionSpacePoint::fromJsonString($dimensionSpacePoint); diff --git a/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/EventSourcedTrait.php b/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/EventSourcedTrait.php index cfd771fba87..54f55f947da 100644 --- a/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/EventSourcedTrait.php +++ b/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/EventSourcedTrait.php @@ -352,7 +352,7 @@ public function beforeEventSourcedScenarioDispatcher(BeforeScenarioScope $scope) * Catch Up process and the testcase reset. */ - $eventTableName = sprintf('cr_%s_events', $this->contentRepositoryId); + $eventTableName = sprintf('cr_%s_events', $this->contentRepositoryId->value); $connection->executeStatement('TRUNCATE ' . $eventTableName); // TODO: WORKAROUND: UGLY AS HELL CODE: Projection Reset may fail because the lock cannot be acquired, so we @@ -404,13 +404,11 @@ protected function readPayloadTable(TableNode $payloadTable): array if (strpos($line['Value'], '$this->') === 0) { // Special case: Referencing stuff from the context here $propertyOrMethodName = substr($line['Value'], strlen('$this->')); - if (method_exists($this, $propertyOrMethodName)) { - // is method - $value = (string)$this->$propertyOrMethodName(); - } else { - // is property - $value = (string)$this->$propertyOrMethodName; - } + $value = match ($propertyOrMethodName) { + 'currentNodeAggregateId' => $this->currentNodeAggregateId()->value, + 'contentStreamId' => $this->contentStreamId->value, + default => method_exists($this, $propertyOrMethodName) ? (string)$this->$propertyOrMethodName() : (string)$this->$propertyOrMethodName, + }; } else { // default case $value = json_decode($line['Value'], true); @@ -551,7 +549,7 @@ public function theSubtreeForNodeAggregateWithNodeTypesAndLevelsDeepShouldBe( $expectedNodeAggregateId = NodeAggregateId::fromString($expectedRow['nodeAggregateId']); $actualNodeAggregateId = $flattenedSubtree[$i]->node->nodeAggregateId; Assert::assertTrue($expectedNodeAggregateId->equals($actualNodeAggregateId), - 'NodeAggregateId does not match in index ' . $i . ', expected: "' . $expectedNodeAggregateId . '", actual: "' . $actualNodeAggregateId . '" (adapter: ' . $adapterName . ')'); + 'NodeAggregateId does not match in index ' . $i . ', expected: "' . $expectedNodeAggregateId->value . '", actual: "' . $actualNodeAggregateId->value . '" (adapter: ' . $adapterName . ')'); } } } @@ -599,7 +597,7 @@ public function iGetTheNodeAddressForNodeAggregate(string $rawNodeAggregateId, $ $subgraph = $this->contentGraph->getSubgraph($this->contentStreamId, $this->dimensionSpacePoint, $this->visibilityConstraints); $nodeAggregateId = NodeAggregateId::fromString($rawNodeAggregateId); $node = $subgraph->findNodeById($nodeAggregateId); - Assert::assertNotNull($node, 'Did not find a node with aggregate id "' . $nodeAggregateId . '"'); + Assert::assertNotNull($node, 'Did not find a node with aggregate id "' . $nodeAggregateId->value . '"'); $this->currentNodeAddresses[$alias] = new NodeAddress( $this->contentStreamId, @@ -679,7 +677,7 @@ public function theContentStreamHasState(string $contentStreamId, string $expect */ public function theCurrentContentStreamHasState(string $expectedState) { - $this->theContentStreamHasState($this->contentStreamId->jsonSerialize(), $expectedState); + $this->theContentStreamHasState($this->contentStreamId->value, $expectedState); } /** diff --git a/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/Features/NodeModification.php b/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/Features/NodeModification.php index 6774cf94604..11420f53662 100644 --- a/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/Features/NodeModification.php +++ b/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/Features/NodeModification.php @@ -49,7 +49,7 @@ public function theCommandSetPropertiesIsExecutedWithPayload(TableNode $payloadT { $commandArguments = $this->readPayloadTable($payloadTable); if (!isset($commandArguments['contentStreamId'])) { - $commandArguments['contentStreamId'] = (string)$this->getCurrentContentStreamId(); + $commandArguments['contentStreamId'] = $this->getCurrentContentStreamId()->value; } if (!isset($commandArguments['originDimensionSpacePoint'])) { $commandArguments['originDimensionSpacePoint'] = $this->getCurrentDimensionSpacePoint()->jsonSerialize(); diff --git a/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/Features/NodeRenaming.php b/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/Features/NodeRenaming.php index a575ddaa809..3f37443e27a 100644 --- a/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/Features/NodeRenaming.php +++ b/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/Features/NodeRenaming.php @@ -45,7 +45,7 @@ public function iExpectTheNodeToHaveTheName(string $nodeAggregateId, string $nod foreach ($this->getCurrentSubgraphs() as $adapterName => $subgraph) { assert($subgraph instanceof ContentSubgraphInterface); $node = $subgraph->findNodeById(NodeAggregateId::fromString($nodeAggregateId)); - Assert::assertEquals($nodeName, (string)$node->nodeName, 'Node Names do not match in adapter ' . $adapterName); + Assert::assertEquals($nodeName, $node->nodeName->value, 'Node Names do not match in adapter ' . $adapterName); } } } diff --git a/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/NodeTraversalTrait.php b/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/NodeTraversalTrait.php index 26ab45ac7ad..79e3f549d39 100644 --- a/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/NodeTraversalTrait.php +++ b/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/NodeTraversalTrait.php @@ -325,7 +325,7 @@ public function iExecuteTheRetrieveNodePathQueryIExpectTheFollowingNodes(string if ($expectedExceptionMessage !== null) { Assert::fail('Expected an exception but none was thrown'); } - Assert::assertSame((string)$expectedNodePath, (string)$actualNodePath); + Assert::assertSame($expectedNodePath->value, $actualNodePath->value); } } diff --git a/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/ProjectedNodeAggregateTrait.php b/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/ProjectedNodeAggregateTrait.php index ca2084c0998..8bd678790f1 100644 --- a/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/ProjectedNodeAggregateTrait.php +++ b/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/ProjectedNodeAggregateTrait.php @@ -48,7 +48,7 @@ public function iExpectTheNodeAggregateToExist(string $serializedNodeAggregateId $nodeAggregateId = NodeAggregateId::fromString($serializedNodeAggregateId); $this->initializeCurrentNodeAggregates(function (ContentGraphInterface $contentGraph, string $adapterName) use ($nodeAggregateId) { $currentNodeAggregate = $contentGraph->findNodeAggregateById($this->contentStreamId, $nodeAggregateId); - Assert::assertNotNull($currentNodeAggregate, sprintf('Node aggregate "%s" was not found in the current content stream "%s" in adapter "%s".', $nodeAggregateId, $this->contentStreamId, $adapterName)); + Assert::assertNotNull($currentNodeAggregate, sprintf('Node aggregate "%s" was not found in the current content stream "%s" in adapter "%s".', $nodeAggregateId->value, $this->contentStreamId->value, $adapterName)); return $currentNodeAggregate; }); } @@ -75,7 +75,7 @@ public function iExpectThisNodeAggregateToOccupyDimensionSpacePoints(string $ser $expectedOccupation, $nodeAggregate->occupiedDimensionSpacePoints, 'Node aggregate origins do not match in adapter "' . $adapterName . '". Expected: ' . - $expectedOccupation . ', actual: ' . $nodeAggregate->occupiedDimensionSpacePoints + $expectedOccupation->toJson() . ', actual: ' . $nodeAggregate->occupiedDimensionSpacePoints->toJson() ); }); } @@ -91,7 +91,7 @@ public function iExpectThisNodeAggregateToCoverDimensionSpacePoints(string $seri Assert::assertEquals( $expectedCoverage, $nodeAggregate->coveredDimensionSpacePoints, - 'Expected node aggregate coverage ' . $expectedCoverage . ', got ' . $nodeAggregate->coveredDimensionSpacePoints . ' in adapter "' . $adapterName . '"' + 'Expected node aggregate coverage ' . $expectedCoverage->toJson() . ', got ' . $nodeAggregate->coveredDimensionSpacePoints->toJson() . ' in adapter "' . $adapterName . '"' ); }); } @@ -107,8 +107,8 @@ public function iExpectThisNodeAggregateToDisableDimensionSpacePoints(string $se Assert::assertEquals( $expectedDisabledDimensionSpacePoints, $nodeAggregate->disabledDimensionSpacePoints, - 'Expected disabled dimension space point set ' . $expectedDisabledDimensionSpacePoints . ', got ' . - $nodeAggregate->disabledDimensionSpacePoints . ' in adapter "' . $adapterName . '"' + 'Expected disabled dimension space point set ' . $expectedDisabledDimensionSpacePoints->toJson() . ', got ' . + $nodeAggregate->disabledDimensionSpacePoints->toJson() . ' in adapter "' . $adapterName . '"' ); }); } @@ -138,9 +138,9 @@ public function iExpectThisNodeAggregateToBeOfType(string $serializedExpectedNod $expectedNodeTypeName = NodeTypeName::fromString($serializedExpectedNodeTypeName); $this->assertOnCurrentNodeAggregates(function (NodeAggregate $nodeAggregate, string $adapterName) use ($expectedNodeTypeName) { Assert::assertSame( - (string)$expectedNodeTypeName, - (string)$nodeAggregate->nodeTypeName, - 'Node types do not match in adapter "' . $adapterName . '". Expected "' . $expectedNodeTypeName . '", got "' . $nodeAggregate->nodeTypeName . '".' + $expectedNodeTypeName->value, + $nodeAggregate->nodeTypeName->value, + 'Node types do not match in adapter "' . $adapterName . '". Expected "' . $expectedNodeTypeName->value . '", got "' . $nodeAggregate->nodeTypeName->value . '".' ); }); } @@ -163,7 +163,7 @@ public function iExpectThisNodeAggregateToHaveTheName(string $serializedExpected { $expectedNodeName = NodeName::fromString($serializedExpectedNodeName); $this->assertOnCurrentNodeAggregates(function (NodeAggregate $nodeAggregate, string $adapterName) use ($expectedNodeName) { - Assert::assertSame((string)$expectedNodeName, (string)$nodeAggregate->nodeName, 'Node names do not match in adapter "' . $adapterName . '", expected "' . $expectedNodeName . '", got "' . $nodeAggregate->nodeName . '".'); + Assert::assertSame($expectedNodeName->value, $nodeAggregate->nodeName->value, 'Node names do not match in adapter "' . $adapterName . '", expected "' . $expectedNodeName->value . '", got "' . $nodeAggregate->nodeName->value . '".'); }); } @@ -192,10 +192,10 @@ public function iExpectThisNodeAggregateToHaveTheParentNodeAggregates(string $se $expectedNodeAggregateIds = NodeAggregateIds::fromJsonString($serializedExpectedNodeAggregateIds); $this->assertOnCurrentNodeAggregates(function (NodeAggregate $nodeAggregate, string $adapterName) use ($expectedNodeAggregateIds) { $expectedDiscriminators = array_values(array_map(function (NodeAggregateId $nodeAggregateId) { - return $this->contentStreamId . ';' . $nodeAggregateId; + return $this->contentStreamId->value . ';' . $nodeAggregateId->value; }, $expectedNodeAggregateIds->getIterator()->getArrayCopy())); $actualDiscriminators = array_values(array_map(function (NodeAggregate $parentNodeAggregate) { - return $parentNodeAggregate->contentStreamId . ';' . $parentNodeAggregate->nodeAggregateId; + return $parentNodeAggregate->contentStreamId->value . ';' . $parentNodeAggregate->nodeAggregateId->value; }, iterator_to_array( $this->getActiveContentGraphs()[$adapterName]->findParentNodeAggregates( $nodeAggregate->contentStreamId, @@ -235,10 +235,10 @@ public function iExpectThisNodeAggregateToHaveTheChildNodeAggregates(string $ser $expectedNodeAggregateIds = NodeAggregateIds::fromJsonString($serializedExpectedNodeAggregateIds); $this->assertOnCurrentNodeAggregates(function (NodeAggregate $nodeAggregate, string $adapterName) use ($expectedNodeAggregateIds) { $expectedDiscriminators = array_values(array_map(function (NodeAggregateId $nodeAggregateId) { - return $this->contentStreamId . ':' . $nodeAggregateId; + return $this->contentStreamId->value . ':' . $nodeAggregateId->value; }, $expectedNodeAggregateIds->getIterator()->getArrayCopy())); $actualDiscriminators = array_values(array_map(function (NodeAggregate $parentNodeAggregate) { - return $parentNodeAggregate->contentStreamId . ':' . $parentNodeAggregate->nodeAggregateId; + return $parentNodeAggregate->contentStreamId->value . ':' . $parentNodeAggregate->nodeAggregateId->value; }, iterator_to_array($this->getActiveContentGraphs()[$adapterName]->findChildNodeAggregates( $nodeAggregate->contentStreamId, $nodeAggregate->nodeAggregateId diff --git a/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/ProjectedNodeTrait.php b/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/ProjectedNodeTrait.php index 682ac13c115..1a67421a981 100644 --- a/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/ProjectedNodeTrait.php +++ b/Neos.ContentRepository.Core/Tests/Behavior/Features/Bootstrap/ProjectedNodeTrait.php @@ -101,9 +101,9 @@ public function iExpectANodeIdentifiedByXToExistInTheContentGraph(string $serial ); Assert::assertNotNull( $currentNode, - 'Node with aggregate id "' . $nodeDiscriminator->getNodeAggregateId() - . '" and originating in dimension space point "' . $nodeDiscriminator->getOriginDimensionSpacePoint() - . '" was not found in content stream "' . $nodeDiscriminator->getContentStreamId() . '"' + 'Node with aggregate id "' . $nodeDiscriminator->getNodeAggregateId()->value + . '" and originating in dimension space point "' . $nodeDiscriminator->getOriginDimensionSpacePoint()->toJson() + . '" was not found in content stream "' . $nodeDiscriminator->getContentStreamId()->value . '"' . '" in adapter "' . $adapterName . '"' ); @@ -124,7 +124,7 @@ public function iExpectNodeAggregateIdToLeadToNode( $expectedDiscriminator = NodeDiscriminator::fromShorthand($serializedNodeDiscriminator); $this->initializeCurrentNodesFromContentSubgraphs(function (ContentSubgraphInterface $subgraph, string $adapterName) use ($nodeAggregateId, $expectedDiscriminator) { $currentNode = $subgraph->findNodeById($nodeAggregateId); - Assert::assertNotNull($currentNode, 'No node could be found by node aggregate id "' . $nodeAggregateId . '" in content subgraph "' . $this->dimensionSpacePoint . '@' . $this->contentStreamId . '" and adapter "' . $adapterName . '"'); + Assert::assertNotNull($currentNode, 'No node could be found by node aggregate id "' . $nodeAggregateId->value . '" in content subgraph "' . $this->dimensionSpacePoint->toJson() . '@' . $this->contentStreamId->value . '" and adapter "' . $adapterName . '"'); $actualDiscriminator = NodeDiscriminator::fromNode($currentNode); Assert::assertTrue($expectedDiscriminator->equals($actualDiscriminator), 'Node discriminators do not match. Expected was ' . json_encode($expectedDiscriminator) . ' , given was ' . json_encode($actualDiscriminator) . ' in adapter "' . $adapterName . '"'); return $currentNode; @@ -143,8 +143,8 @@ public function iExpectNodeAggregateIdToLeadToNoNode(string $serializedNodeAggre $nodeByAggregateId = $subgraph->findNodeById($nodeAggregateId); if (!is_null($nodeByAggregateId)) { Assert::fail( - 'A node was found by node aggregate id "' . $nodeAggregateId - . '" in content subgraph {' . $this->dimensionSpacePoint . ',' . $this->contentStreamId + 'A node was found by node aggregate id "' . $nodeAggregateId->value + . '" in content subgraph {' . $this->dimensionSpacePoint->toJson() . ',' . $this->contentStreamId->value . '} and adapter "' . $adapterName . '"' ); } @@ -167,7 +167,7 @@ public function iExpectPathToLeadToNode(string $serializedNodePath, string $seri $expectedDiscriminator = NodeDiscriminator::fromShorthand($serializedNodeDiscriminator); $this->initializeCurrentNodesFromContentSubgraphs(function (ContentSubgraphInterface $subgraph, string $adapterName) use ($nodePath, $expectedDiscriminator) { $currentNode = $subgraph->findNodeByPath($nodePath, $this->getRootNodeAggregateId()); - Assert::assertNotNull($currentNode, 'No node could be found by node path "' . $nodePath . '" in content subgraph "' . $this->dimensionSpacePoint . '@' . $this->contentStreamId . '" and adapter "' . $adapterName . '"'); + Assert::assertNotNull($currentNode, 'No node could be found by node path "' . $nodePath->value . '" in content subgraph "' . $this->dimensionSpacePoint->toJson() . '@' . $this->contentStreamId->value . '" and adapter "' . $adapterName . '"'); $actualDiscriminator = NodeDiscriminator::fromNode($currentNode); Assert::assertTrue($expectedDiscriminator->equals($actualDiscriminator), 'Node discriminators do not match. Expected was ' . json_encode($expectedDiscriminator) . ' , given was ' . json_encode($actualDiscriminator) . ' in adapter "' . $adapterName . '"'); return $currentNode; @@ -187,7 +187,7 @@ public function iExpectPathToLeadToNoNode(string $serializedNodePath): void $nodePath = NodePath::fromString($serializedNodePath); foreach ($this->getCurrentSubgraphs() as $adapterName => $subgraph) { $nodeByPath = $subgraph->findNodeByPath($nodePath, $this->getRootNodeAggregateId()); - Assert::assertNull($nodeByPath, 'A node was found by node path "' . $nodePath . '" in content subgraph "' . $this->dimensionSpacePoint . '@' . $this->contentStreamId . '" and adapter "' . $adapterName . '"'); + Assert::assertNull($nodeByPath, 'A node was found by node path "' . $nodePath->value . '" in content subgraph "' . $this->dimensionSpacePoint->toJson() . '@' . $this->contentStreamId->value . '" and adapter "' . $adapterName . '"'); } } @@ -259,7 +259,7 @@ public function iExpectThisNodeToBeOfType(string $serializedExpectedNodeTypeName $expectedNodeTypeName = NodeTypeName::fromString($serializedExpectedNodeTypeName); $this->assertOnCurrentNodes(function (Node $currentNode, string $adapterName) use ($expectedNodeTypeName) { $actualNodeTypeName = $currentNode->nodeTypeName; - Assert::assertSame($expectedNodeTypeName, $actualNodeTypeName, 'Actual node type name "' . $actualNodeTypeName .'" does not match expected "' . $expectedNodeTypeName . '" in adapter "' . $adapterName . '"'); + Assert::assertSame($expectedNodeTypeName, $actualNodeTypeName, 'Actual node type name "' . $actualNodeTypeName->value .'" does not match expected "' . $expectedNodeTypeName->value . '" in adapter "' . $adapterName . '"'); }); } @@ -272,7 +272,7 @@ public function iExpectThisNodeToBeNamed(string $serializedExpectedNodeName): vo $expectedNodeName = NodeName::fromString($serializedExpectedNodeName); $this->assertOnCurrentNodes(function (Node $currentNode, string $adapterName) use ($expectedNodeName) { $actualNodeName = $currentNode->nodeName; - Assert::assertSame((string)$expectedNodeName, (string)$actualNodeName, 'Actual node name "' . $actualNodeName .'" does not match expected "' . $expectedNodeName . '" in adapter "' . $adapterName . '"'); + Assert::assertSame($expectedNodeName->value, $actualNodeName->value, 'Actual node name "' . $actualNodeName->value .'" does not match expected "' . $expectedNodeName->value . '" in adapter "' . $adapterName . '"'); }); } @@ -521,7 +521,7 @@ public function iExpectThisNodeToHaveTheFollowingChildNodes(TableNode $expectedC foreach ($expectedChildNodesTable->getHash() as $index => $row) { $expectedNodeName = NodeName::fromString($row['Name']); $actualNodeName = $actualChildNodes[$index]->nodeName; - Assert::assertEquals($expectedNodeName, $actualNodeName, 'ContentSubgraph::findChildNodes: Node name in index ' . $index . ' does not match in adapter "' . $adapterName . '". Expected: "' . $expectedNodeName . '" Actual: "' . $actualNodeName . '"'); + Assert::assertTrue($expectedNodeName->equals($actualNodeName), 'ContentSubgraph::findChildNodes: Node name in index ' . $index . ' does not match in adapter "' . $adapterName . '". Expected: "' . $expectedNodeName->value . '" Actual: "' . $actualNodeName->value . '"'); if (isset($row['NodeDiscriminator'])) { $expectedNodeDiscriminator = NodeDiscriminator::fromShorthand($row['NodeDiscriminator']); $actualNodeDiscriminator = NodeDiscriminator::fromNode($actualChildNodes[$index]); diff --git a/Neos.ContentRepository.Core/Tests/Unit/DimensionSpace/Fixtures/ExampleDimensionSource.php b/Neos.ContentRepository.Core/Tests/Unit/DimensionSpace/Fixtures/ExampleDimensionSource.php index 932c66a9bbb..7a08fbe1fc6 100644 --- a/Neos.ContentRepository.Core/Tests/Unit/DimensionSpace/Fixtures/ExampleDimensionSource.php +++ b/Neos.ContentRepository.Core/Tests/Unit/DimensionSpace/Fixtures/ExampleDimensionSource.php @@ -113,7 +113,7 @@ public function getDimension(Dimension\ContentDimensionId $dimensionId): ?Dimens $this->initializeDimensions(); } - return $this->dimensions[(string)$dimensionId] ?? null; + return $this->dimensions[$dimensionId->value] ?? null; } /** diff --git a/Neos.ContentRepository.Core/Tests/Unit/DimensionSpace/Fixtures/VariationExampleDimensionSource.php b/Neos.ContentRepository.Core/Tests/Unit/DimensionSpace/Fixtures/VariationExampleDimensionSource.php index 25cba9c0fa5..a298e93fc39 100644 --- a/Neos.ContentRepository.Core/Tests/Unit/DimensionSpace/Fixtures/VariationExampleDimensionSource.php +++ b/Neos.ContentRepository.Core/Tests/Unit/DimensionSpace/Fixtures/VariationExampleDimensionSource.php @@ -74,7 +74,7 @@ public function getDimension(Dimension\ContentDimensionId $dimensionId): ?Dimens $this->initializeDimensions(); } - return $this->dimensions[(string)$dimensionId] ?? null; + return $this->dimensions[$dimensionId->value] ?? null; } /** diff --git a/Neos.ContentRepository.Core/Tests/Unit/DimensionSpace/InterDimensionalVariationGraphTest.php b/Neos.ContentRepository.Core/Tests/Unit/DimensionSpace/InterDimensionalVariationGraphTest.php index c74c209080d..f540794e500 100644 --- a/Neos.ContentRepository.Core/Tests/Unit/DimensionSpace/InterDimensionalVariationGraphTest.php +++ b/Neos.ContentRepository.Core/Tests/Unit/DimensionSpace/InterDimensionalVariationGraphTest.php @@ -638,7 +638,7 @@ public function testDetermineWeightNormalizationBaseEvaluatesToMaximumDimensionD $dimensionZookeeper ]); - $this->assertSame(max($firstDepth->depth, $secondDepth->depth) + 1, $graph->_call('determineWeightNormalizationBase')); + $this->assertSame(max($firstDepth->value, $secondDepth->value) + 1, $graph->_call('determineWeightNormalizationBase')); } public function testGetVariantTypeCorrectlyDeterminesTheVariantType() diff --git a/Neos.ContentRepository.Export/src/Processors/EventExportProcessor.php b/Neos.ContentRepository.Export/src/Processors/EventExportProcessor.php index cdd3721b5aa..e6dc0642e8f 100644 --- a/Neos.ContentRepository.Export/src/Processors/EventExportProcessor.php +++ b/Neos.ContentRepository.Export/src/Processors/EventExportProcessor.php @@ -39,7 +39,7 @@ public function run(): ProcessorResult return ProcessorResult::error('Failed to find live workspace'); } $streamName = StreamName::fromString( - 'ContentStream:' . $liveWorkspace->currentContentStreamId + 'ContentStream:' . $liveWorkspace->currentContentStreamId->value ); $eventStream = $this->eventStore->load($streamName); diff --git a/Neos.ContentRepository.Export/src/Processors/EventStoreImportProcessor.php b/Neos.ContentRepository.Export/src/Processors/EventStoreImportProcessor.php index fc711a86c40..bf91ff2c6d6 100644 --- a/Neos.ContentRepository.Export/src/Processors/EventStoreImportProcessor.php +++ b/Neos.ContentRepository.Export/src/Processors/EventStoreImportProcessor.php @@ -65,7 +65,7 @@ public function run(): ProcessorResult $keepStreamName = true; } if (!$keepStreamName) { - $event = $event->processPayload(fn(array $payload) => isset($payload['contentStreamId']) ? [...$payload, 'contentStreamId' => (string)$this->contentStreamId] : $payload); + $event = $event->processPayload(fn(array $payload) => isset($payload['contentStreamId']) ? [...$payload, 'contentStreamId' => $this->contentStreamId->value] : $payload); } if (!$this->keepEventIds) { try { @@ -108,7 +108,7 @@ public function run(): ProcessorResult assert($this->contentStreamId !== null); - $contentStreamStreamName = StreamName::fromString('ContentStream:' . $this->contentStreamId); + $contentStreamStreamName = StreamName::fromString('ContentStream:' . $this->contentStreamId->value); $events = Events::with( $this->normalizeEvent( new ContentStreamWasCreated( @@ -123,7 +123,7 @@ public function run(): ProcessorResult } $workspaceName = WorkspaceName::forLive(); - $workspaceStreamName = StreamName::fromString('Workspace:' . $workspaceName->name); + $workspaceStreamName = StreamName::fromString('Workspace:' . $workspaceName->value); $events = Events::with( $this->normalizeEvent( new RootWorkspaceWasCreated( diff --git a/Neos.ContentRepository.LegacyNodeMigration/Classes/Helpers/AssetExtractor.php b/Neos.ContentRepository.LegacyNodeMigration/Classes/Helpers/AssetExtractor.php index a9b3e78dc35..f7479da4c39 100644 --- a/Neos.ContentRepository.LegacyNodeMigration/Classes/Helpers/AssetExtractor.php +++ b/Neos.ContentRepository.LegacyNodeMigration/Classes/Helpers/AssetExtractor.php @@ -31,16 +31,16 @@ public function run(iterable $nodeDataRows): iterable // Note: We use a PostgreSQL platform because the implementation is forward-compatible, @see JsonArrayType::convertToPHPValue() $decodedProperties = (new JsonArrayType())->convertToPHPValue($nodeDataRow['properties'], new PostgreSQL100Platform()); } catch (\Throwable $e) { - throw new MigrationException(sprintf('Failed to decode properties %s of node "%s" (type: "%s"): %s', json_encode($nodeDataRow['properties']), $nodeDataRow['identifier'], $nodeTypeName, $e->getMessage()), 1656057030, $e); + throw new MigrationException(sprintf('Failed to decode properties %s of node "%s" (type: "%s"): %s', json_encode($nodeDataRow['properties']), $nodeDataRow['identifier'], $nodeTypeName->value, $e->getMessage()), 1656057030, $e); } if (!is_array($decodedProperties)) { - throw new MigrationException(sprintf('Failed to decode properties %s of node "%s" (type: "%s")', json_encode($nodeDataRow['properties']), $nodeDataRow['identifier'], $nodeTypeName), 1656057035); + throw new MigrationException(sprintf('Failed to decode properties %s of node "%s" (type: "%s")', json_encode($nodeDataRow['properties']), $nodeDataRow['identifier'], $nodeTypeName->value), 1656057035); } foreach ($decodedProperties as $propertyName => $propertyValue) { try { yield from $this->extractAssets($propertyValue); } catch (\Throwable $e) { - throw new MigrationException(sprintf('Failed to extract assets from property "%s" of node "%s" (type: "%s"): %s', $propertyName, $nodeDataRow['identifier'], $nodeTypeName, $e->getMessage()), 1656931260, $e); + throw new MigrationException(sprintf('Failed to extract assets from property "%s" of node "%s" (type: "%s"): %s', $propertyName, $nodeDataRow['identifier'], $nodeTypeName->value, $e->getMessage()), 1656931260, $e); } } } diff --git a/Neos.ContentRepository.LegacyNodeMigration/Classes/Helpers/VisitedNodeAggregate.php b/Neos.ContentRepository.LegacyNodeMigration/Classes/Helpers/VisitedNodeAggregate.php index e0376cad2ef..a3bee18746f 100644 --- a/Neos.ContentRepository.LegacyNodeMigration/Classes/Helpers/VisitedNodeAggregate.php +++ b/Neos.ContentRepository.LegacyNodeMigration/Classes/Helpers/VisitedNodeAggregate.php @@ -29,7 +29,7 @@ public function __construct( public function addVariant(OriginDimensionSpacePoint $originDimensionSpacePoint, NodeAggregateId $parentNodeAggregateId): void { if (isset($this->variants[$originDimensionSpacePoint->hash])) { - throw new MigrationException(sprintf('Node "%s" with dimension space point "%s" was already visited before', $this->nodeAggregateId, $originDimensionSpacePoint), 1653050442); + throw new MigrationException(sprintf('Node "%s" with dimension space point "%s" was already visited before', $this->nodeAggregateId->value, $originDimensionSpacePoint->toJson()), 1653050442); } $this->variants[$originDimensionSpacePoint->hash] = new VisitedNodeVariant($originDimensionSpacePoint, $parentNodeAggregateId); } @@ -42,7 +42,7 @@ public function getOriginDimensionSpacePoints(): OriginDimensionSpacePointSet public function getVariant(OriginDimensionSpacePoint $originDimensionSpacePoint): VisitedNodeVariant { if (!isset($this->variants[$originDimensionSpacePoint->hash])) { - throw new \InvalidArgumentException(sprintf('Variant %s of node "%s" has not been visited before', $originDimensionSpacePoint, $this->nodeAggregateId), 1656058159); + throw new \InvalidArgumentException(sprintf('Variant %s of node "%s" has not been visited before', $originDimensionSpacePoint->toJson(), $this->nodeAggregateId->value), 1656058159); } return $this->variants[$originDimensionSpacePoint->hash]; } diff --git a/Neos.ContentRepository.LegacyNodeMigration/Classes/Helpers/VisitedNodeAggregates.php b/Neos.ContentRepository.LegacyNodeMigration/Classes/Helpers/VisitedNodeAggregates.php index d2d8d4be57a..85460f9677d 100644 --- a/Neos.ContentRepository.LegacyNodeMigration/Classes/Helpers/VisitedNodeAggregates.php +++ b/Neos.ContentRepository.LegacyNodeMigration/Classes/Helpers/VisitedNodeAggregates.php @@ -37,13 +37,13 @@ public function add(NodeAggregateId $nodeAggregateId, DimensionSpacePointSet $co { $visitedNodeAggregate = $this->byNodeAggregateId[$nodeAggregateId->value] ?? new VisitedNodeAggregate($nodeAggregateId, $nodeTypeName); if (!$nodeTypeName->equals($visitedNodeAggregate->nodeTypeName)) { - throw new MigrationException(sprintf('Node aggregate with id "%s" has a type of "%s" in content dimension %s. I was visited previously for content dimension %s with the type "%s". Node variants must not have different types', $nodeAggregateId, $nodeTypeName, $coveredDimensionSpacePoints, $visitedNodeAggregate->getOriginDimensionSpacePoints(), $visitedNodeAggregate->nodeTypeName), 1655913685); + throw new MigrationException(sprintf('Node aggregate with id "%s" has a type of "%s" in content dimension %s. I was visited previously for content dimension %s with the type "%s". Node variants must not have different types', $nodeAggregateId->value, $nodeTypeName->value, $coveredDimensionSpacePoints->toJson(), $visitedNodeAggregate->getOriginDimensionSpacePoints()->toJson(), $visitedNodeAggregate->nodeTypeName->value), 1655913685); } foreach ($coveredDimensionSpacePoints as $dimensionSpacePoint) { $visitedNodeAggregate->addVariant(OriginDimensionSpacePoint::fromDimensionSpacePoint($dimensionSpacePoint), $parentNodeAggregateId); - $pathAndDimensionSpacePointHash = $nodePath->jsonSerialize() . '__' . $dimensionSpacePoint->hash; + $pathAndDimensionSpacePointHash = $nodePath->value . '__' . $dimensionSpacePoint->hash; if (isset($this->byPathAndDimensionSpacePoint[$pathAndDimensionSpacePointHash])) { - throw new MigrationException(sprintf('Node "%s" with path "%s" and dimension space point "%s" was already visited before', $nodeAggregateId, $nodePath, $dimensionSpacePoint), 1655900356); + throw new MigrationException(sprintf('Node "%s" with path "%s" and dimension space point "%s" was already visited before', $nodeAggregateId->value, $nodePath->value, $dimensionSpacePoint->toJson()), 1655900356); } $this->byPathAndDimensionSpacePoint[$pathAndDimensionSpacePointHash] = $visitedNodeAggregate; } @@ -58,7 +58,7 @@ public function containsNodeAggregate(NodeAggregateId $nodeAggregateId): bool public function getByNodeAggregateId(NodeAggregateId $nodeAggregateId): VisitedNodeAggregate { if (!isset($this->byNodeAggregateId[$nodeAggregateId->value])) { - throw new \InvalidArgumentException(sprintf('Node aggregate with id "%s" has not been visited before', $nodeAggregateId), 1655912733); + throw new \InvalidArgumentException(sprintf('Node aggregate with id "%s" has not been visited before', $nodeAggregateId->value), 1655912733); } return $this->byNodeAggregateId[$nodeAggregateId->value]; } @@ -71,11 +71,11 @@ public function alreadyVisitedOriginDimensionSpacePoints(NodeAggregateId $nodeAg public function findMostSpecificParentNodeInDimensionGraph(NodePath $nodePath, OriginDimensionSpacePoint $originDimensionSpacePoint, InterDimensionalVariationGraph $interDimensionalVariationGraph): ?VisitedNodeAggregate { $dimensionSpacePoint = $originDimensionSpacePoint->toDimensionSpacePoint(); - $nodePathParts = $nodePath->getParts(); + $nodePathParts = explode('/', ltrim($nodePath->value, '/')); array_pop($nodePathParts); $parentPath = NodePath::fromPathSegments($nodePathParts); while ($dimensionSpacePoint !== null) { - $parentPathAndDimensionSpacePointHash = strtolower($parentPath->jsonSerialize()) . '__' . $dimensionSpacePoint->hash; + $parentPathAndDimensionSpacePointHash = strtolower($parentPath->value) . '__' . $dimensionSpacePoint->hash; if (isset($this->byPathAndDimensionSpacePoint[$parentPathAndDimensionSpacePointHash])) { return $this->byPathAndDimensionSpacePoint[$parentPathAndDimensionSpacePointHash]; } diff --git a/Neos.ContentRepository.LegacyNodeMigration/Classes/NodeDataToEventsProcessor.php b/Neos.ContentRepository.LegacyNodeMigration/Classes/NodeDataToEventsProcessor.php index 28b084b2daa..d5a0bcf7daf 100644 --- a/Neos.ContentRepository.LegacyNodeMigration/Classes/NodeDataToEventsProcessor.php +++ b/Neos.ContentRepository.LegacyNodeMigration/Classes/NodeDataToEventsProcessor.php @@ -193,7 +193,7 @@ private function processNodeData(array $nodeDataRow): void $originDimensionSpacePoint = OriginDimensionSpacePoint::fromLegacyDimensionArray($dimensionArray); $parentNodeAggregate = $this->visitedNodes->findMostSpecificParentNodeInDimensionGraph($nodePath, $originDimensionSpacePoint, $this->interDimensionalVariationGraph); if ($parentNodeAggregate === null) { - throw new MigrationException(sprintf('Failed to find parent node for node with id "%s" and dimensions: %s. Did you properly configure your dimensions setup to be in sync with the old setup?', $nodeAggregateId, $originDimensionSpacePoint), 1655980069); + throw new MigrationException(sprintf('Failed to find parent node for node with id "%s" and dimensions: %s. Did you properly configure your dimensions setup to be in sync with the old setup?', $nodeAggregateId->value, $originDimensionSpacePoint->toJson()), 1655980069); } $pathParts = $nodePath->getParts(); $nodeName = end($pathParts); @@ -232,7 +232,7 @@ public function extractPropertyValuesAndReferences(array $nodeDataRow, NodeType // Note: We use a PostgreSQL platform because the implementation is forward-compatible, @see JsonArrayType::convertToPHPValue() $decodedProperties = (new JsonArrayType())->convertToPHPValue($nodeDataRow['properties'], new PostgreSQL100Platform()); if (!is_array($decodedProperties)) { - throw new MigrationException(sprintf('Failed to decode properties %s of node "%s" (type: "%s")', json_encode($nodeDataRow['properties']), $nodeDataRow['identifier'], $nodeType), 1656057035); + throw new MigrationException(sprintf('Failed to decode properties %s of node "%s" (type: "%s")', json_encode($nodeDataRow['properties']), $nodeDataRow['identifier'], $nodeType->name), 1656057035); } foreach ($decodedProperties as $propertyName => $propertyValue) { @@ -292,7 +292,7 @@ private function createNodeVariant(NodeAggregateId $nodeAggregateId, OriginDimen } } if ($variantCreatedEvent === null) { - throw new MigrationException(sprintf('Node "%s" for dimension %s was already created previously', $nodeAggregateId, $originDimensionSpacePoint), 1656057201); + throw new MigrationException(sprintf('Node "%s" for dimension %s was already created previously', $nodeAggregateId->value, $originDimensionSpacePoint->toJson()), 1656057201); } $this->exportEvent($variantCreatedEvent); if ($serializedPropertyValuesAndReferences->serializedPropertyValues->count() > 0) { diff --git a/Neos.ContentRepository.LegacyNodeMigration/Tests/Behavior/Bootstrap/FeatureContext.php b/Neos.ContentRepository.LegacyNodeMigration/Tests/Behavior/Bootstrap/FeatureContext.php index 6c9675f1b97..9b1bb069421 100644 --- a/Neos.ContentRepository.LegacyNodeMigration/Tests/Behavior/Bootstrap/FeatureContext.php +++ b/Neos.ContentRepository.LegacyNodeMigration/Tests/Behavior/Bootstrap/FeatureContext.php @@ -96,7 +96,7 @@ public function iHaveTheFollowingNodeDataRows(TableNode $nodeDataRows): void return [ 'path' => $row['Path'], 'parentpath' => implode('/', array_slice(explode('/', $row['Path']), 0, -1)) ?: '/', - 'identifier' => $row['Identifier'] ?? (string)NodeAggregateId::create(), + 'identifier' => $row['Identifier'] ?? NodeAggregateId::create()->value, 'nodetype' => $row['Node Type'] ?? 'unstructured', 'properties' => !empty($row['Properties']) ? $row['Properties'] : '{}', 'dimensionvalues' => !empty($row['Dimension Values']) ? $row['Dimension Values'] : '{}', diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ChildrenOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ChildrenOperation.php index bb4d88ff1ea..147075a9ac7 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ChildrenOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ChildrenOperation.php @@ -11,7 +11,6 @@ * source code. */ -use Neos\ContentRepository\Core\NodeType\NodeTypeConstraintParser; use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter; use Neos\ContentRepository\Core\SharedModel\Node\NodeName; use Neos\ContentRepository\Core\Projection\ContentGraph\NodeTypeConstraints; @@ -86,9 +85,9 @@ public function evaluate(FlowQuery $flowQuery, array $arguments) $childNodes = $this->contentRepositoryRegistry->subgraphForNode($contextNode) ->findChildNodes($contextNode->nodeAggregateId, FindChildNodesFilter::create()); foreach ($childNodes as $childNode) { - if (!isset($outputNodeAggregateIds[(string)$childNode->nodeAggregateId])) { + if (!isset($outputNodeAggregateIds[$childNode->nodeAggregateId->value])) { $output[] = $childNode; - $outputNodeAggregateIds[(string)$childNode->nodeAggregateId] = true; + $outputNodeAggregateIds[$childNode->nodeAggregateId->value] = true; } } } @@ -151,10 +150,10 @@ protected function earlyOptimizationOfFilters(FlowQuery $flowQuery, array $parse } if (!is_null($resolvedNode) && !isset($filteredOutputNodeIdentifiers[ - (string)$resolvedNode->nodeAggregateId + $resolvedNode->nodeAggregateId->value ])) { $filteredOutput[] = $resolvedNode; - $filteredOutputNodeIdentifiers[(string)$resolvedNode->nodeAggregateId] = true; + $filteredOutputNodeIdentifiers[$resolvedNode->nodeAggregateId->value] = true; } } } elseif (count($instanceOfFilters) > 0) { @@ -178,10 +177,10 @@ protected function earlyOptimizationOfFilters(FlowQuery $flowQuery, array $parse foreach ($childNodes as $childNode) { if (!isset($filteredOutputNodeIdentifiers[ - (string)$childNode->nodeAggregateId + $childNode->nodeAggregateId->value ])) { $filteredOutput[] = $childNode; - $filteredOutputNodeIdentifiers[(string)$childNode->nodeAggregateId] = true; + $filteredOutputNodeIdentifiers[$childNode->nodeAggregateId->value] = true; } } } @@ -201,8 +200,9 @@ protected function earlyOptimizationOfFilters(FlowQuery $flowQuery, array $parse } // Add filtered nodes to output + /** @var Node $filteredNode */ foreach ($filteredOutput as $filteredNode) { - if (!isset($outputNodeAggregateIds[(string)$filteredNode->nodeAggregateId])) { + if (!isset($outputNodeAggregateIds[$filteredNode->nodeAggregateId->value])) { $output[] = $filteredNode; } } diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ClosestOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ClosestOperation.php index 8b032c2b71c..52b5d4d1c82 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ClosestOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ClosestOperation.php @@ -75,7 +75,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments) foreach ($contextNodeQuery as $result) { /* @var Node $result */ - $output[(string)$result->nodeAggregateId] = $result; + $output[$result->nodeAggregateId->value] = $result; } } diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/FilterOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/FilterOperation.php index 7bda720796d..011b21d9b7e 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/FilterOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/FilterOperation.php @@ -104,7 +104,7 @@ protected function matchesPropertyNameFilter($element, $propertyNameFilter) */ protected function matchesIdentifierFilter($element, $identifier) { - return (strtolower((string)$element->nodeAggregateId) === strtolower($identifier)); + return (strtolower($element->nodeAggregateId->value) === strtolower($identifier)); } /** diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/FindOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/FindOperation.php index 6d2e5a87140..07dcf3137e0 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/FindOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/FindOperation.php @@ -197,8 +197,8 @@ protected function getEntryPoints(array $contextNodes): array foreach ($contextNodes as $contextNode) { assert($contextNode instanceof Node); $subgraph = $this->contentRepositoryRegistry->subgraphForNode($contextNode); - $subgraphIdentifier = md5($contextNode->subgraphIdentity->contentStreamId - . '@' . $contextNode->subgraphIdentity->dimensionSpacePoint); + $subgraphIdentifier = md5($contextNode->subgraphIdentity->contentStreamId->value + . '@' . $contextNode->subgraphIdentity->dimensionSpacePoint->toJson()); if (!isset($entryPoints[(string) $subgraphIdentifier])) { $entryPoints[(string) $subgraphIdentifier] = [ 'subgraph' => $subgraph, diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/NextAllOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/NextAllOperation.php index 5013af318a8..d644f2d7a69 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/NextAllOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/NextAllOperation.php @@ -70,8 +70,8 @@ public function evaluate(FlowQuery $flowQuery, array $arguments) $outputNodePaths = []; foreach ($flowQuery->getContext() as $contextNode) { foreach ($this->getNextForNode($contextNode) as $nextNode) { - if ($nextNode !== null && !isset($outputNodePaths[(string)$nextNode->nodeAggregateId])) { - $outputNodePaths[(string)$nextNode->nodeAggregateId] = true; + if ($nextNode !== null && !isset($outputNodePaths[$nextNode->nodeAggregateId->value])) { + $outputNodePaths[$nextNode->nodeAggregateId->value] = true; $output[] = $nextNode; } } diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/NextOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/NextOperation.php index 27ad6a8ada6..797142689be 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/NextOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/NextOperation.php @@ -70,8 +70,8 @@ public function evaluate(FlowQuery $flowQuery, array $arguments) $outputNodePaths = []; foreach ($flowQuery->getContext() as $contextNode) { $nextNode = $this->getNextForNode($contextNode); - if ($nextNode !== null && !isset($outputNodePaths[(string)$nextNode->nodeAggregateId])) { - $outputNodePaths[(string)$nextNode->nodeAggregateId] = true; + if ($nextNode !== null && !isset($outputNodePaths[$nextNode->nodeAggregateId->value])) { + $outputNodePaths[$nextNode->nodeAggregateId->value] = true; $output[] = $nextNode; } } diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/NextUntilOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/NextUntilOperation.php index bd15cbeb532..5006fdb6222 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/NextUntilOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/NextUntilOperation.php @@ -88,8 +88,8 @@ public function evaluate(FlowQuery $flowQuery, array $arguments) foreach ($nextNodes as $nextNode) { if ($nextNode !== null - && !isset($outputNodeIdentifiers[(string)$nextNode->nodeAggregateId])) { - $outputNodeIdentifiers[(string)$nextNode->nodeAggregateId] = true; + && !isset($outputNodeIdentifiers[$nextNode->nodeAggregateId->value])) { + $outputNodeIdentifiers[$nextNode->nodeAggregateId->value] = true; $output[] = $nextNode; } } diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ParentOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ParentOperation.php index b46f8733cb3..57f1037f6e1 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ParentOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ParentOperation.php @@ -74,9 +74,9 @@ public function evaluate(FlowQuery $flowQuery, array $arguments) continue; } - if (!isset($outputNodeAggregateIds[(string)$parentNode->nodeAggregateId])) { + if (!isset($outputNodeAggregateIds[$parentNode->nodeAggregateId->value])) { $output[] = $parentNode; - $outputNodeAggregateIds[(string)$parentNode->nodeAggregateId] = true; + $outputNodeAggregateIds[$parentNode->nodeAggregateId->value] = true; } } diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ParentsUntilOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ParentsUntilOperation.php index 489c0ba848c..6d347b52a12 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ParentsUntilOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/ParentsUntilOperation.php @@ -83,8 +83,8 @@ public function evaluate(FlowQuery $flowQuery, array $arguments) foreach ($parentNodes as $parentNode) { if ($parentNode !== null - && !isset($outputNodeAggregateIds[(string)$parentNode->nodeAggregateId])) { - $outputNodeAggregateIds[(string)$parentNode->nodeAggregateId] = true; + && !isset($outputNodeAggregateIds[$parentNode->nodeAggregateId->value])) { + $outputNodeAggregateIds[$parentNode->nodeAggregateId->value] = true; $output[] = $parentNode; } } diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PrevAllOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PrevAllOperation.php index 4c152a249d9..81a1a8afb22 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PrevAllOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PrevAllOperation.php @@ -71,9 +71,9 @@ public function evaluate(FlowQuery $flowQuery, array $arguments) foreach ($flowQuery->getContext() as $contextNode) { foreach ($this->getPrevForNode($contextNode) as $prevNode) { if ($prevNode !== null - && !isset($outputNodeAggregateIds[(string)$prevNode->nodeAggregateId]) + && !isset($outputNodeAggregateIds[$prevNode->nodeAggregateId->value]) ) { - $outputNodeAggregateIds[(string)$prevNode->nodeAggregateId] = true; + $outputNodeAggregateIds[$prevNode->nodeAggregateId->value] = true; $output[] = $prevNode; } } diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PrevOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PrevOperation.php index eacb45e1430..c8e885f8393 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PrevOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PrevOperation.php @@ -69,8 +69,8 @@ public function evaluate(FlowQuery $flowQuery, array $arguments): void $outputNodePaths = []; foreach ($flowQuery->getContext() as $contextNode) { $nextNode = $this->getPrevForNode($contextNode); - if ($nextNode !== null && !isset($outputNodePaths[(string)$nextNode->nodeAggregateId])) { - $outputNodePaths[(string)$nextNode->nodeAggregateId] = true; + if ($nextNode !== null && !isset($outputNodePaths[$nextNode->nodeAggregateId->value])) { + $outputNodePaths[$nextNode->nodeAggregateId->value] = true; $output[] = $nextNode; } } diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PrevUntilOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PrevUntilOperation.php index 25e477c4218..fe1dea0f61c 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PrevUntilOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PrevUntilOperation.php @@ -88,8 +88,8 @@ public function evaluate(FlowQuery $flowQuery, array $arguments): void foreach ($prevNodes as $prevNode) { if ($prevNode !== null && - !isset($outputNodeIdentifiers[(string)$prevNode->nodeAggregateId])) { - $outputNodeIdentifiers[(string)$prevNode->nodeAggregateId] = true; + !isset($outputNodeIdentifiers[$prevNode->nodeAggregateId->value])) { + $outputNodeIdentifiers[$prevNode->nodeAggregateId->value] = true; $output[] = $prevNode; } } diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PropertyOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PropertyOperation.php index 35bacdd368a..555569d38ca 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PropertyOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PropertyOperation.php @@ -92,7 +92,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments): mixed $element = $context[0]; if ($propertyName === '_path') { $subgraph = $this->contentRepositoryRegistry->subgraphForNode($element); - return (string)$subgraph->retrieveNodePath($element->nodeAggregateId); + return $subgraph->retrieveNodePath($element->nodeAggregateId)->value; } if ($propertyName[0] === '_') { diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/SiblingsOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/SiblingsOperation.php index 50b18c13619..d25894deee4 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/SiblingsOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/SiblingsOperation.php @@ -68,7 +68,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments): void $outputNodeAggregateIds = []; foreach ($flowQuery->getContext() as $contextNode) { /** @var Node $contextNode */ - $outputNodeAggregateIds[(string)$contextNode->nodeAggregateId] = true; + $outputNodeAggregateIds[$contextNode->nodeAggregateId->value] = true; } foreach ($flowQuery->getContext() as $contextNode) { @@ -83,9 +83,9 @@ public function evaluate(FlowQuery $flowQuery, array $arguments): void foreach ( $subgraph->findChildNodes($parentNode->nodeAggregateId, FindChildNodesFilter::create()) as $childNode ) { - if (!isset($outputNodeAggregateIds[(string)$childNode->nodeAggregateId])) { + if (!isset($outputNodeAggregateIds[$childNode->nodeAggregateId->value])) { $output[] = $childNode; - $outputNodeAggregateIds[(string)$childNode->nodeAggregateId] = true; + $outputNodeAggregateIds[$childNode->nodeAggregateId->value] = true; } } } diff --git a/Neos.ContentRepository.NodeMigration/src/Filter/NodeNameFilterFactory.php b/Neos.ContentRepository.NodeMigration/src/Filter/NodeNameFilterFactory.php index 575b4599760..226908ad481 100644 --- a/Neos.ContentRepository.NodeMigration/src/Filter/NodeNameFilterFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Filter/NodeNameFilterFactory.php @@ -43,7 +43,7 @@ public function matches(NodeAggregate $nodeAggregate): bool if (!$nodeAggregate->nodeName) { return false; } - return $this->nodeName->jsonSerialize() === $nodeAggregate->nodeName->jsonSerialize(); + return $this->nodeName->equals($nodeAggregate->nodeName); } }; } diff --git a/Neos.ContentRepository.NodeMigration/src/Filter/NodeTypeFilterFactory.php b/Neos.ContentRepository.NodeMigration/src/Filter/NodeTypeFilterFactory.php index fd193d9e00b..5bc18ec52ce 100644 --- a/Neos.ContentRepository.NodeMigration/src/Filter/NodeTypeFilterFactory.php +++ b/Neos.ContentRepository.NodeMigration/src/Filter/NodeTypeFilterFactory.php @@ -72,18 +72,18 @@ public function __construct( public function matches(NodeAggregate $nodeAggregate): bool { - $nodeTypes = [$this->nodeTypeName]; + $nodeTypes = [$this->nodeTypeName->value]; if ($this->withSubTypes) { foreach ($this->nodeTypeManager->getSubNodeTypes($this->nodeTypeName) as $nodeType) { - $nodeTypes[] = $nodeType->getName(); + $nodeTypes[] = $nodeType->name->value; } } if ($this->exclude) { - return !in_array($nodeAggregate->nodeTypeName->value, $nodeTypes); + return !in_array($nodeAggregate->nodeTypeName->value, $nodeTypes, true); } else { // non-negated - return in_array($nodeAggregate->nodeTypeName->value, $nodeTypes); + return in_array($nodeAggregate->nodeTypeName->value, $nodeTypes, true); } } }; diff --git a/Neos.ContentRepository.NodeMigration/src/NodeMigrationService.php b/Neos.ContentRepository.NodeMigration/src/NodeMigrationService.php index a0c020e9eab..eb39817b7ff 100644 --- a/Neos.ContentRepository.NodeMigration/src/NodeMigrationService.php +++ b/Neos.ContentRepository.NodeMigration/src/NodeMigrationService.php @@ -64,7 +64,7 @@ public function executeMigration(ExecuteMigration $command): void if ($workspace === null) { throw new WorkspaceDoesNotExist(sprintf( 'The workspace %s does not exist', - $command->getWorkspaceName() + $command->getWorkspaceName()->value ), 1611688225); } @@ -72,9 +72,9 @@ public function executeMigration(ExecuteMigration $command): void $contentStreamForWriting = $command->getOrCreateContentStreamIdForWriting($step); $this->contentRepository->handle( new CreateWorkspace( - WorkspaceName::fromString($contentStreamForWriting->jsonSerialize()), + WorkspaceName::fromString($contentStreamForWriting->value), $workspace->workspaceName, - WorkspaceTitle::fromString($contentStreamForWriting->jsonSerialize()), + WorkspaceTitle::fromString($contentStreamForWriting->value), WorkspaceDescription::fromString(''), $contentStreamForWriting, ) diff --git a/Neos.ContentRepository.Security/Classes/Authorization/Privilege/Node/NodePrivilegeContext.php b/Neos.ContentRepository.Security/Classes/Authorization/Privilege/Node/NodePrivilegeContext.php index 04ae4518624..49c1bc39ee2 100644 --- a/Neos.ContentRepository.Security/Classes/Authorization/Privilege/Node/NodePrivilegeContext.php +++ b/Neos.ContentRepository.Security/Classes/Authorization/Privilege/Node/NodePrivilegeContext.php @@ -61,7 +61,7 @@ public function isAncestorNodeOf(string $nodePathOrIdentifier): bool return $nodePathOrResult; } - return str_starts_with($nodePathOrResult, (string)$this->getSubgraph()->retrieveNodePath($this->node->nodeAggregateId)); + return str_starts_with($nodePathOrResult, $this->getSubgraph()->retrieveNodePath($this->node->nodeAggregateId)->value); } /** @@ -80,7 +80,7 @@ public function isDescendantNodeOf(string $nodePathOrIdentifier): bool return $nodePathOrResult; } - return str_starts_with((string)$this->getSubgraph()->retrieveNodePath($this->node->nodeAggregateId), $nodePathOrResult); + return str_starts_with($this->getSubgraph()->retrieveNodePath($this->node->nodeAggregateId)->value, $nodePathOrResult); } /** @@ -138,7 +138,7 @@ public function isInWorkspace(array $workspaceNames): bool $workspace = $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId( $this->node->subgraphIdentity->contentStreamId ); - return !is_null($workspace) && in_array((string)$workspace->workspaceName, $workspaceNames); + return !is_null($workspace) && in_array($workspace->workspaceName->value, $workspaceNames); } /** @@ -186,7 +186,7 @@ protected function resolveNodePathOrResult(string $nodePathOrIdentifier): bool|s if (is_null($otherNode)) { return false; } - return $this->getSubgraph()->retrieveNodePath($otherNode->nodeAggregateId) . '/'; + return $this->getSubgraph()->retrieveNodePath($otherNode->nodeAggregateId)->value . '/'; } catch (\InvalidArgumentException $e) { return rtrim($nodePathOrIdentifier, '/') . '/'; } diff --git a/Neos.ContentRepository.Security/Classes/Service/AuthorizationService.php b/Neos.ContentRepository.Security/Classes/Service/AuthorizationService.php index 866b4938b4b..c95ff197d5f 100644 --- a/Neos.ContentRepository.Security/Classes/Service/AuthorizationService.php +++ b/Neos.ContentRepository.Security/Classes/Service/AuthorizationService.php @@ -98,10 +98,14 @@ public function getNodeTypeNamesDeniedForCreation(Node $referenceNode) continue; } - $affectedNodeTypes = ($createNodePrivilege->getCreationNodeTypes() !== [] ? $createNodePrivilege->getCreationNodeTypes() : $allNodeTypes); + if ($createNodePrivilege->getCreationNodeTypes() !== []) { + $affectedNodeTypes = $createNodePrivilege->getCreationNodeTypes(); + } else { + $affectedNodeTypes = array_map(static fn (NodeType $nodeType) => $nodeType->name->value, $allNodeTypes); + } if ($createNodePrivilege->isGranted()) { - $grantedCreationNodeTypes = array_merge($grantedCreationNodeTypes, $affectedNodeTypes); + $grantedCreationNodeTypes[] = array_merge($grantedCreationNodeTypes, $affectedNodeTypes); } elseif ($createNodePrivilege->isDenied()) { $deniedCreationNodeTypes = array_merge($deniedCreationNodeTypes, $affectedNodeTypes); } else { diff --git a/Neos.ContentRepository.StructureAdjustment/src/Adjustment/DimensionAdjustment.php b/Neos.ContentRepository.StructureAdjustment/src/Adjustment/DimensionAdjustment.php index 355cf2a15ea..08af46c972a 100644 --- a/Neos.ContentRepository.StructureAdjustment/src/Adjustment/DimensionAdjustment.php +++ b/Neos.ContentRepository.StructureAdjustment/src/Adjustment/DimensionAdjustment.php @@ -51,8 +51,8 @@ public function findAdjustmentsForNodeType(NodeTypeName $nodeTypeName): \Generat You need to write a node migration to update the database to fix this case. ', - json_encode($node->originDimensionSpacePoint->jsonSerialize()), - json_encode($coveredDimensionSpacePoint->jsonSerialize()), + $node->originDimensionSpacePoint->toJson(), + $coveredDimensionSpacePoint->toJson(), strtoupper($variantType->value) ); diff --git a/Neos.ContentRepository.StructureAdjustment/src/Adjustment/DisallowedChildNodeAdjustment.php b/Neos.ContentRepository.StructureAdjustment/src/Adjustment/DisallowedChildNodeAdjustment.php index 987200f8420..0dfa463e7ee 100644 --- a/Neos.ContentRepository.StructureAdjustment/src/Adjustment/DisallowedChildNodeAdjustment.php +++ b/Neos.ContentRepository.StructureAdjustment/src/Adjustment/DisallowedChildNodeAdjustment.php @@ -87,7 +87,7 @@ public function findAdjustmentsForNodeType(NodeTypeName $nodeTypeName): \Generat $grandparentNodeType = $this->loadNodeType($grandparentNode->nodeTypeName); if ($grandparentNodeType !== null) { $allowedByGrandparent = $grandparentNodeType->allowsGrandchildNodeType( - $parentNode->nodeName->jsonSerialize(), + $parentNode->nodeName->value, $nodeType ); } @@ -105,10 +105,10 @@ public function findAdjustmentsForNodeType(NodeTypeName $nodeTypeName): \Generat and the grandparent node type "%s" is not allowing grandchildren of type "%s". Thus, the node is invalid at this location and should be removed. ', - $parentNodeType !== null ? $parentNodeType->getName() : '', - $node->nodeTypeName->jsonSerialize(), - $grandparentNodeType !== null ? $grandparentNodeType->getName() : '', - $node->nodeTypeName->jsonSerialize(), + $parentNodeType !== null ? $parentNodeType->name->value : '', + $node->nodeTypeName->value, + $grandparentNodeType !== null ? $grandparentNodeType->name->value : '', + $node->nodeTypeName->value, ); yield StructureAdjustment::createForNode( diff --git a/Neos.ContentRepository.StructureAdjustment/src/Adjustment/LoadNodeTypeTrait.php b/Neos.ContentRepository.StructureAdjustment/src/Adjustment/LoadNodeTypeTrait.php index 3963999e930..2728d52caad 100644 --- a/Neos.ContentRepository.StructureAdjustment/src/Adjustment/LoadNodeTypeTrait.php +++ b/Neos.ContentRepository.StructureAdjustment/src/Adjustment/LoadNodeTypeTrait.php @@ -22,8 +22,8 @@ abstract protected function getNodeTypeManager(): NodeTypeManager; protected function loadNodeType(NodeTypeName $nodeTypeName): ?NodeType { try { - $nodeType = $this->getNodeTypeManager()->getNodeType((string)$nodeTypeName); - if ($nodeType->getName() !== $nodeTypeName->jsonSerialize()) { + $nodeType = $this->getNodeTypeManager()->getNodeType($nodeTypeName->value); + if (!$nodeTypeName->equals($nodeType->name)) { // the $nodeTypeName was different than the fetched node type; so that means // that the FallbackNodeType has been returned. return null; diff --git a/Neos.ContentRepository.StructureAdjustment/src/Adjustment/StructureAdjustment.php b/Neos.ContentRepository.StructureAdjustment/src/Adjustment/StructureAdjustment.php index b80ae7cc468..d532e0232fc 100644 --- a/Neos.ContentRepository.StructureAdjustment/src/Adjustment/StructureAdjustment.php +++ b/Neos.ContentRepository.StructureAdjustment/src/Adjustment/StructureAdjustment.php @@ -52,9 +52,9 @@ public static function createForNode( . ($remediation ? '' : '!!!NOT AUTO-FIXABLE YET!!! ') . $errorMessage, null, [ - 'contentStream' => $node->subgraphIdentity->contentStreamId->jsonSerialize(), - 'dimensionSpacePoint' => json_encode($node->originDimensionSpacePoint->jsonSerialize()), - 'nodeAggregateId' => $node->nodeAggregateId->jsonSerialize(), + 'contentStream' => $node->subgraphIdentity->contentStreamId->value, + 'dimensionSpacePoint' => $node->originDimensionSpacePoint->toJson(), + 'nodeAggregateId' => $node->nodeAggregateId->value, 'isAutoFixable' => ($remediation !== null) ], $type, @@ -73,8 +73,8 @@ public static function createForNodeAggregate( . ($remediation ? '' : '!!!NOT AUTO-FIXABLE YET!!! ') . $errorMessage, null, [ - 'contentStream' => $nodeAggregate->contentStreamId->jsonSerialize(), - 'nodeAggregateId' => $nodeAggregate->nodeAggregateId->jsonSerialize(), + 'contentStream' => $nodeAggregate->contentStreamId->value, + 'nodeAggregateId' => $nodeAggregate->nodeAggregateId->value, 'isAutoFixable' => ($remediation !== null) ], $type, diff --git a/Neos.ContentRepository.StructureAdjustment/src/Adjustment/TetheredNodeAdjustments.php b/Neos.ContentRepository.StructureAdjustment/src/Adjustment/TetheredNodeAdjustments.php index a5ef4788d10..7bff3925f22 100644 --- a/Neos.ContentRepository.StructureAdjustment/src/Adjustment/TetheredNodeAdjustments.php +++ b/Neos.ContentRepository.StructureAdjustment/src/Adjustment/TetheredNodeAdjustments.php @@ -79,7 +79,7 @@ public function findAdjustmentsForNodeType(NodeTypeName $nodeTypeName): \Generat yield StructureAdjustment::createForNode( $node, StructureAdjustment::TETHERED_NODE_MISSING, - 'The tethered child node "' . $tetheredNodeName . '" is missing.', + 'The tethered child node "' . $tetheredNodeName->value . '" is missing.', function () use ($nodeAggregate, $node, $tetheredNodeName, $expectedTetheredNodeType) { $events = $this->createEventsForMissingTetheredNode( $nodeAggregate, @@ -114,13 +114,13 @@ function () use ($nodeAggregate, $node, $tetheredNodeName, $expectedTetheredNode ); foreach ($tetheredNodeAggregates as $tetheredNodeAggregate) { /* @var $tetheredNodeAggregate NodeAggregate */ - if (!isset($expectedTetheredNodes[(string)$tetheredNodeAggregate->nodeName])) { + if (!isset($expectedTetheredNodes[$tetheredNodeAggregate->nodeName->value])) { $foundMissingOrDisallowedTetheredNodes = true; yield StructureAdjustment::createForNodeAggregate( $tetheredNodeAggregate, StructureAdjustment::DISALLOWED_TETHERED_NODE, 'The tethered child node "' - . $tetheredNodeAggregate->nodeName . '" should be removed.', + . $tetheredNodeAggregate->nodeName->value . '" should be removed.', function () use ($tetheredNodeAggregate) { return $this->removeNodeAggregate($tetheredNodeAggregate); } @@ -143,7 +143,7 @@ function () use ($tetheredNodeAggregate) { $actualTetheredChildNodes = []; foreach ($childNodes as $childNode) { if ($childNode->classification->isTethered()) { - $actualTetheredChildNodes[(string)$childNode->nodeName] = $childNode; + $actualTetheredChildNodes[$childNode->nodeName->value] = $childNode; } } @@ -194,7 +194,7 @@ private function ensureNodeIsOfType(Node $node, NodeType $expectedNodeType): \Ge yield StructureAdjustment::createForNode( $node, StructureAdjustment::TETHERED_NODE_TYPE_WRONG, - 'should be of type "' . $expectedNodeType . '", but was "' . $node->nodeTypeName->value . '".' + 'should be of type "' . $expectedNodeType->name->value . '", but was "' . $node->nodeTypeName->value . '".' ); } } diff --git a/Neos.ContentRepository.StructureAdjustment/src/Adjustment/UnknownNodeTypeAdjustment.php b/Neos.ContentRepository.StructureAdjustment/src/Adjustment/UnknownNodeTypeAdjustment.php index 5363534f721..903ae844770 100644 --- a/Neos.ContentRepository.StructureAdjustment/src/Adjustment/UnknownNodeTypeAdjustment.php +++ b/Neos.ContentRepository.StructureAdjustment/src/Adjustment/UnknownNodeTypeAdjustment.php @@ -39,7 +39,7 @@ private function removeAllNodesOfType(NodeTypeName $nodeTypeName): \Generator yield StructureAdjustment::createForNodeAggregate( $nodeAggregate, StructureAdjustment::NODE_TYPE_MISSING, - 'The node type "' . $nodeTypeName->jsonSerialize() + 'The node type "' . $nodeTypeName->value . '" is not found; so the node should be removed (or converted)', function () use ($nodeAggregate) { return $this->removeNodeAggregate($nodeAggregate); diff --git a/Neos.ContentRepositoryRegistry/Classes/Command/ContentCommandController.php b/Neos.ContentRepositoryRegistry/Classes/Command/ContentCommandController.php index 42d6943fab1..e4592aacb5d 100644 --- a/Neos.ContentRepositoryRegistry/Classes/Command/ContentCommandController.php +++ b/Neos.ContentRepositoryRegistry/Classes/Command/ContentCommandController.php @@ -46,7 +46,7 @@ public function refreshRootNodeDimensionsCommand(string $contentRepository = 'de $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); $workspace = $contentRepository->getWorkspaceFinder()->findOneByName(WorkspaceName::fromString($workspace)); - $this->outputFormatted('Refreshing root node dimensions in workspace %s (content repository %s)', [$workspace->workspaceName->name, $contentRepositoryId->value]); + $this->outputFormatted('Refreshing root node dimensions in workspace %s (content repository %s)', [$workspace->workspaceName->value, $contentRepositoryId->value]); $this->outputFormatted('Resolved content stream %s', [$workspace->currentContentStreamId]); $rootNodeAggregates = $contentRepository->getContentGraph()->findRootNodeAggregates( @@ -101,7 +101,7 @@ public function createVariantsRecursivelyCommand(string $source, string $target, $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); $workspace = $contentRepository->getWorkspaceFinder()->findOneByName(WorkspaceName::fromString($workspace)); - $this->outputFormatted('Creating %s to %s in workspace %s (content repository %s)', [$source, $target, $workspace->workspaceName->name, $contentRepositoryId->value]); + $this->outputFormatted('Creating %s to %s in workspace %s (content repository %s)', [$source, $target, $workspace->workspaceName->value, $contentRepositoryId->value]); $this->outputFormatted('Resolved content stream %s', [$workspace->currentContentStreamId]); $sourceSubgraph = $contentRepository->getContentGraph()->getSubgraph( diff --git a/Neos.ContentRepositoryRegistry/Classes/Factory/EventStore/DoctrineEventStoreFactory.php b/Neos.ContentRepositoryRegistry/Classes/Factory/EventStore/DoctrineEventStoreFactory.php index 6e49f32dda8..391b77050f3 100644 --- a/Neos.ContentRepositoryRegistry/Classes/Factory/EventStore/DoctrineEventStoreFactory.php +++ b/Neos.ContentRepositoryRegistry/Classes/Factory/EventStore/DoctrineEventStoreFactory.php @@ -28,6 +28,6 @@ public function build(ContentRepositoryId $contentRepositoryId, array $contentRe public static function databaseTableName(ContentRepositoryId $contentRepositoryId): string { - return sprintf('cr_%s_events', $contentRepositoryId); + return sprintf('cr_%s_events', $contentRepositoryId->value); } } diff --git a/Neos.EventSourcedContentRepository.LegacyApi/Classes/ContextInNodeBasedReadModel/EmulatedLegacyBaseWorkspace.php b/Neos.EventSourcedContentRepository.LegacyApi/Classes/ContextInNodeBasedReadModel/EmulatedLegacyBaseWorkspace.php index 54ea0407545..69a82b3e23c 100644 --- a/Neos.EventSourcedContentRepository.LegacyApi/Classes/ContextInNodeBasedReadModel/EmulatedLegacyBaseWorkspace.php +++ b/Neos.EventSourcedContentRepository.LegacyApi/Classes/ContextInNodeBasedReadModel/EmulatedLegacyBaseWorkspace.php @@ -38,7 +38,7 @@ public function getName(): string LogEnvironment::fromMethodName(__METHOD__) ); - return (string)$this->childWorkspace->baseWorkspaceName; + return $this->childWorkspace->baseWorkspaceName?->value ?? ''; } /** diff --git a/Neos.EventSourcedContentRepository.LegacyApi/Classes/ContextInNodeBasedReadModel/EmulatedLegacyContext.php b/Neos.EventSourcedContentRepository.LegacyApi/Classes/ContextInNodeBasedReadModel/EmulatedLegacyContext.php index 5ee106f5e90..5cbe26bc800 100644 --- a/Neos.EventSourcedContentRepository.LegacyApi/Classes/ContextInNodeBasedReadModel/EmulatedLegacyContext.php +++ b/Neos.EventSourcedContentRepository.LegacyApi/Classes/ContextInNodeBasedReadModel/EmulatedLegacyContext.php @@ -75,7 +75,7 @@ public function getWorkspaceName(): ?string { $this->legacyLogger->info('context.workspaceName called', LogEnvironment::fromMethodName(__METHOD__)); - return $this->getNodeAddressOfContextNode()->workspaceName->name; + return $this->getNodeAddressOfContextNode()->workspaceName->value; } public function getWorkspace(): EmulatedLegacyWorkspace diff --git a/Neos.EventSourcedContentRepository.LegacyApi/Classes/ContextInNodeBasedReadModel/EmulatedLegacySite.php b/Neos.EventSourcedContentRepository.LegacyApi/Classes/ContextInNodeBasedReadModel/EmulatedLegacySite.php index 5bcc9228c29..d9ad313aa96 100644 --- a/Neos.EventSourcedContentRepository.LegacyApi/Classes/ContextInNodeBasedReadModel/EmulatedLegacySite.php +++ b/Neos.EventSourcedContentRepository.LegacyApi/Classes/ContextInNodeBasedReadModel/EmulatedLegacySite.php @@ -50,7 +50,7 @@ public function getSiteResourcesPackageKey(): ?string $siteNodeName = $siteNode->nodeName; /* @var ?Site $site */ - $site = $siteNodeName ? $this->siteRepository->findOneByNodeName((string)$siteNodeName) : null; + $site = $siteNodeName ? $this->siteRepository->findOneByNodeName($siteNodeName->value) : null; return $site?->getSiteResourcesPackageKey(); } diff --git a/Neos.EventSourcedContentRepository.LegacyApi/Classes/FlowQueryContextOperation/ContextOperation.php b/Neos.EventSourcedContentRepository.LegacyApi/Classes/FlowQueryContextOperation/ContextOperation.php index 71941aeac09..d4f6ac6fbf0 100644 --- a/Neos.EventSourcedContentRepository.LegacyApi/Classes/FlowQueryContextOperation/ContextOperation.php +++ b/Neos.EventSourcedContentRepository.LegacyApi/Classes/FlowQueryContextOperation/ContextOperation.php @@ -120,7 +120,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments): void ) ->findNodeById($contextNode->nodeAggregateId); if ($nodeInModifiedSubgraph !== null) { - $output[$nodeInModifiedSubgraph->nodeAggregateId->__toString()] = $nodeInModifiedSubgraph; + $output[$nodeInModifiedSubgraph->nodeAggregateId->value] = $nodeInModifiedSubgraph; } } diff --git a/Neos.Media.Browser/Classes/Controller/UsageController.php b/Neos.Media.Browser/Classes/Controller/UsageController.php index 6b26b1b2c14..eb3dab88e26 100644 --- a/Neos.Media.Browser/Classes/Controller/UsageController.php +++ b/Neos.Media.Browser/Classes/Controller/UsageController.php @@ -115,8 +115,8 @@ public function relatedNodesAction(AssetInterface $asset) $workspace = $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId($usage->getContentStreamId()); $accessible = $this->domainUserService->currentUserCanReadWorkspace($workspace); - $inaccessibleRelation['nodeIdentifier'] = $usage->getNodeAggregateId(); - $inaccessibleRelation['workspaceName'] = $workspace->workspaceName->name; + $inaccessibleRelation['nodeIdentifier'] = $usage->getNodeAggregateId()->value; + $inaccessibleRelation['workspaceName'] = $workspace->workspaceName->value; $inaccessibleRelation['workspace'] = $workspace; $inaccessibleRelation['nodeType'] = $nodeType; $inaccessibleRelation['accessible'] = $accessible; @@ -173,6 +173,4 @@ public function relatedNodesAction(AssetInterface $asset) 'userWorkspace' => $userWorkspace ]); } - - } diff --git a/Neos.Media.Browser/Resources/Private/Templates/Usage/RelatedNodes.html b/Neos.Media.Browser/Resources/Private/Templates/Usage/RelatedNodes.html index 4039ca9bc79..802fb0ab35b 100644 --- a/Neos.Media.Browser/Resources/Private/Templates/Usage/RelatedNodes.html +++ b/Neos.Media.Browser/Resources/Private/Templates/Usage/RelatedNodes.html @@ -142,7 +142,7 @@ - {nodeInformation.workspace.workspaceTitle -> f:format.crop(maxCharacters: 25, append: '…')} + {nodeInformation.workspace.workspaceTitle.value -> f:format.crop(maxCharacters: 25, append: '…')} diff --git a/Neos.Neos/Classes/Aspects/PluginUriAspect.php b/Neos.Neos/Classes/Aspects/PluginUriAspect.php index d5e367a6bc1..73b6846302b 100644 --- a/Neos.Neos/Classes/Aspects/PluginUriAspect.php +++ b/Neos.Neos/Classes/Aspects/PluginUriAspect.php @@ -81,7 +81,7 @@ public function rewritePluginViewUris(JoinPointInterface $joinPoint) $subgraph = $this->contentRepositoryRegistry->subgraphForNode($targetNode); $documentNode = $targetNode; while ($documentNode instanceof Node) { - if ($documentNode->nodeType->isOfType((string)NodeTypeNameFactory::forDocument())) { + if ($documentNode->nodeType->isOfType(NodeTypeNameFactory::forDocument()->value)) { break; } $documentNode = $subgraph->findParentNode($documentNode->nodeAggregateId); diff --git a/Neos.Neos/Classes/AssetUsage/Dto/NodeAddress.php b/Neos.Neos/Classes/AssetUsage/Dto/NodeAddress.php index 87da8c921e9..84d8c88d634 100644 --- a/Neos.Neos/Classes/AssetUsage/Dto/NodeAddress.php +++ b/Neos.Neos/Classes/AssetUsage/Dto/NodeAddress.php @@ -31,9 +31,9 @@ public function __toString(): string { return sprintf( 'NodeAddress[contentStream=%s, dimensionSpacePoint=%s, nodeAggregateId=%s]', - $this->contentStreamId, - $this->dimensionSpacePoint, - $this->nodeAggregateId + $this->contentStreamId->value, + $this->dimensionSpacePoint->toJson(), + $this->nodeAggregateId->value ); } } diff --git a/Neos.Neos/Classes/AssetUsage/Projection/AssetUsageRepository.php b/Neos.Neos/Classes/AssetUsage/Projection/AssetUsageRepository.php index f7d6e9d2b60..1ce01808011 100644 --- a/Neos.Neos/Classes/AssetUsage/Projection/AssetUsageRepository.php +++ b/Neos.Neos/Classes/AssetUsage/Projection/AssetUsageRepository.php @@ -113,7 +113,7 @@ public function findUsages(AssetUsageFilter $filter): AssetUsages } if ($filter->hasContentStreamId()) { $queryBuilder->andWhere('contentStreamId = :contentStreamId'); - $queryBuilder->setParameter('contentStreamId', $filter->contentStreamId); + $queryBuilder->setParameter('contentStreamId', $filter->contentStreamId?->value); } if ($filter->groupByAsset) { $queryBuilder->addGroupBy('assetId'); @@ -159,8 +159,8 @@ public function addUsagesForNode(NodeAddress $nodeAddress, AssetIdsByProperty $a . ' AND nodeAggregateId = :nodeAggregateId' . ' AND originDimensionSpacePointHash = :originDimensionSpacePointHash' . ' AND propertyName IN (:propertyNames)', [ - 'contentStreamId' => $nodeAddress->contentStreamId, - 'nodeAggregateId' => $nodeAddress->nodeAggregateId, + 'contentStreamId' => $nodeAddress->contentStreamId->value, + 'nodeAggregateId' => $nodeAddress->nodeAggregateId->value, 'originDimensionSpacePointHash' => $nodeAddress->dimensionSpacePoint->hash, 'propertyNames' => $assetIdsByProperty->propertyNames(), ], [ @@ -174,9 +174,9 @@ public function addUsagesForNode(NodeAddress $nodeAddress, AssetIdsByProperty $a $this->dbal->insert($this->tableNamePrefix, [ 'assetId' => $assetIdAndOriginalAssetId->assetId, 'originalAssetId' => $assetIdAndOriginalAssetId->originalAssetId, - 'contentStreamId' => $nodeAddress->contentStreamId, - 'nodeAggregateId' => $nodeAddress->nodeAggregateId, - 'originDimensionSpacePoint' => json_encode($nodeAddress->dimensionSpacePoint, JSON_THROW_ON_ERROR), + 'contentStreamId' => $nodeAddress->contentStreamId->value, + 'nodeAggregateId' => $nodeAddress->nodeAggregateId->value, + 'originDimensionSpacePoint' => $nodeAddress->dimensionSpacePoint->toJson(), 'originDimensionSpacePointHash' => $nodeAddress->dimensionSpacePoint->hash, 'propertyName' => $propertyName, ]); @@ -189,7 +189,7 @@ public function addUsagesForNode(NodeAddress $nodeAddress, AssetIdsByProperty $a public function removeContentStream(ContentStreamId $contentStreamId): void { - $this->dbal->delete($this->tableNamePrefix, ['contentStreamId' => $contentStreamId]); + $this->dbal->delete($this->tableNamePrefix, ['contentStreamId' => $contentStreamId->value]); } public function copyContentStream( @@ -203,8 +203,8 @@ public function copyContentStream( . ' FROM ' . $this->tableNamePrefix . ' WHERE contentStreamId = :sourceContentStreamId', [ - 'sourceContentStreamId' => $sourceContentStreamId, - 'targetContentStreamId' => $targetContentStreamId, + 'sourceContentStreamId' => $sourceContentStreamId->value, + 'targetContentStreamId' => $targetContentStreamId->value, ] ); } @@ -223,7 +223,7 @@ public function copyDimensions( . ' WHERE originDimensionSpacePointHash = :sourceOriginDimensionSpacePointHash', [ 'sourceOriginDimensionSpacePointHash' => $sourceOriginDimensionSpacePoint->hash, - 'targetOriginDimensionSpacePoint' => json_encode($targetOriginDimensionSpacePoint, JSON_THROW_ON_ERROR), + 'targetOriginDimensionSpacePoint' => $targetOriginDimensionSpacePoint->toJson(), 'targetOriginDimensionSpacePointHash' => $targetOriginDimensionSpacePoint->hash, ] ); @@ -236,9 +236,9 @@ public function remove(AssetUsage $usage): void { $this->dbal->delete($this->tableNamePrefix, [ 'assetId' => $usage->assetId, - 'contentStreamId' => $usage->contentStreamId, - 'nodeAggregateId' => $usage->nodeAggregateId, - 'originDimensionSpacePointHash' => $usage->originDimensionSpacePoint, + 'contentStreamId' => $usage->contentStreamId->value, + 'nodeAggregateId' => $usage->nodeAggregateId->value, + 'originDimensionSpacePointHash' => $usage->originDimensionSpacePoint->hash, 'propertyName' => $usage->propertyName, ]); } @@ -259,7 +259,7 @@ public function removeNode( . ' WHERE nodeAggregateId = :nodeAggregateId' . ' AND originDimensionSpacePointHash IN (:dimensionSpacePointHashes)', [ - 'nodeAggregateId' => $nodeAggregateId, + 'nodeAggregateId' => $nodeAggregateId->value, 'dimensionSpacePointHashes' => $dimensionSpacePoints->getPointHashes(), ], [ diff --git a/Neos.Neos/Classes/AssetUsage/Projection/AssetUsageRepositoryFactory.php b/Neos.Neos/Classes/AssetUsage/Projection/AssetUsageRepositoryFactory.php index ff6cc9f3119..99012d1bdfd 100644 --- a/Neos.Neos/Classes/AssetUsage/Projection/AssetUsageRepositoryFactory.php +++ b/Neos.Neos/Classes/AssetUsage/Projection/AssetUsageRepositoryFactory.php @@ -21,7 +21,7 @@ public function build(ContentRepositoryId $contentRepositoryId): AssetUsageRepos { return new AssetUsageRepository( $this->dbal, - sprintf('cr_%s_p_neos_%s', $contentRepositoryId, 'asset_usage') + sprintf('cr_%s_p_neos_%s', $contentRepositoryId->value, 'asset_usage') ); } } diff --git a/Neos.Neos/Classes/Controller/Backend/ContentController.php b/Neos.Neos/Classes/Controller/Backend/ContentController.php index c92802e8a20..976864a65f7 100644 --- a/Neos.Neos/Classes/Controller/Backend/ContentController.php +++ b/Neos.Neos/Classes/Controller/Backend/ContentController.php @@ -484,7 +484,7 @@ public function masterPluginsAction(string $workspaceName = 'live', array $dimen continue; } $translationHelper = new TranslationHelper(); - $masterPlugins[(string)$pluginNode->nodeAggregateId] = $translationHelper->translate( + $masterPlugins[$pluginNode->nodeAggregateId->value] = $translationHelper->translate( 'masterPlugins.nodeTypeOnPageLabel', null, [ diff --git a/Neos.Neos/Classes/Controller/Frontend/NodeController.php b/Neos.Neos/Classes/Controller/Frontend/NodeController.php index 88f9f7c3426..3da1db1c6e3 100644 --- a/Neos.Neos/Classes/Controller/Frontend/NodeController.php +++ b/Neos.Neos/Classes/Controller/Frontend/NodeController.php @@ -14,38 +14,33 @@ namespace Neos\Neos\Controller\Frontend; -use Neos\ContentGraph\DoctrineDbalAdapter\Domain\Repository\ContentSubgraph; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphWithRuntimeCaches\ContentSubgraphWithRuntimeCaches; +use Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphWithRuntimeCaches\InMemoryCache; +use Neos\ContentRepository\Core\Projection\ContentGraph\ContentSubgraphInterface; use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindSubtreeFilter; -use Neos\ContentRepository\Core\Projection\ContentGraph\Nodes; -use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; -use Neos\ContentRepository\Core\Projection\ContentGraph\NodePath; -use Neos\ContentRepository\Core\NodeType\NodeTypeConstraintParser; -use Neos\Neos\FrontendRouting\NodeAddressFactory; -use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateIds; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; +use Neos\ContentRepository\Core\Projection\ContentGraph\NodePath; +use Neos\ContentRepository\Core\Projection\ContentGraph\Nodes; use Neos\ContentRepository\Core\Projection\ContentGraph\Subtree; -use Neos\Neos\FrontendRouting\NodeAddress; -use Neos\ContentRepository\Core\Projection\ContentGraph\NodeTypeConstraints; -use Neos\ContentRepository\Core\Projection\ContentGraph\NodeTypeConstraintsWithSubNodeTypes; use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints; -use Neos\ContentRepository\Core\Projection\ContentGraph\ContentSubgraphInterface; -use Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphWithRuntimeCaches\InMemoryCache; +use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; -use Neos\Neos\FrontendRouting\Exception\NodeNotFoundException; -use Neos\Neos\FrontendRouting\NodeShortcutResolver; -use Neos\Neos\Domain\Service\NodeSiteResolvingService; -use Neos\Flow\Security\Authorization\PrivilegeManagerInterface; -use Neos\Neos\FrontendRouting\Exception\InvalidShortcutException; -use Neos\Neos\FrontendRouting\NodeUriBuilder; use Neos\Flow\Annotations as Flow; use Neos\Flow\Mvc\Controller\ActionController; use Neos\Flow\Mvc\Exception\NoMatchingRouteException; use Neos\Flow\Property\PropertyMapper; +use Neos\Flow\Security\Authorization\PrivilegeManagerInterface; use Neos\Flow\Security\Context as SecurityContext; use Neos\Flow\Session\SessionInterface; use Neos\Flow\Utility\Now; +use Neos\Neos\Domain\Service\NodeSiteResolvingService; +use Neos\Neos\FrontendRouting\Exception\InvalidShortcutException; +use Neos\Neos\FrontendRouting\Exception\NodeNotFoundException; +use Neos\Neos\FrontendRouting\NodeAddress; +use Neos\Neos\FrontendRouting\NodeAddressFactory; +use Neos\Neos\FrontendRouting\NodeShortcutResolver; +use Neos\Neos\FrontendRouting\NodeUriBuilder; use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult; use Neos\Neos\View\FusionView; diff --git a/Neos.Neos/Classes/Controller/Module/Management/WorkspacesController.php b/Neos.Neos/Classes/Controller/Module/Management/WorkspacesController.php index 8998a50398f..d08c3ea6667 100644 --- a/Neos.Neos/Classes/Controller/Module/Management/WorkspacesController.php +++ b/Neos.Neos/Classes/Controller/Module/Management/WorkspacesController.php @@ -124,7 +124,7 @@ public function indexAction() } $workspacesAndCounts = [ - $userWorkspace->workspaceName->jsonSerialize() => [ + $userWorkspace->workspaceName->value => [ 'workspace' => $userWorkspace, 'changesCounts' => $this->computeChangesCount($userWorkspace, $contentRepository), 'canPublish' => false, @@ -138,7 +138,7 @@ public function indexAction() /** @var \Neos\ContentRepository\Core\Projection\Workspace\Workspace $workspace */ // FIXME: This check should be implemented through a specialized Workspace Privilege or something similar if (!$workspace->isPersonalWorkspace() && ($workspace->isInternalWorkspace() || $this->domainUserService->currentUserCanManageWorkspace($workspace))) { - $workspaceName = (string)$workspace->workspaceName; + $workspaceName = $workspace->workspaceName->value; $workspacesAndCounts[$workspaceName]['workspace'] = $workspace; $workspacesAndCounts[$workspaceName]['changesCounts'] = $this->computeChangesCount($workspace, $contentRepository); @@ -220,12 +220,12 @@ public function createAction( $contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId); $workspaceName = WorkspaceName::fromString( - Utility::renderValidNodeName((string)$title) . '-' + Utility::renderValidNodeName($title->value) . '-' . substr(base_convert(microtime(false), 10, 36), -5, 5) ); while ($contentRepository->getWorkspaceFinder()->findOneByName($workspaceName) instanceof Workspace) { $workspaceName = WorkspaceName::fromString( - Utility::renderValidNodeName((string)$title) . '-' + Utility::renderValidNodeName($title->value) . '-' . substr(base_convert(microtime(false), 10, 36), -5, 5) ); } @@ -318,7 +318,7 @@ public function updateAction(Workspace $workspace) #$this->workspaceFinder->update($workspace); $this->addFlashMessage($this->translator->translateById( 'workspaces.workspaceHasBeenUpdated', - [(string)$workspace->workspaceTitle], + [$workspace->workspaceTitle?->value], null, null, 'Modules', @@ -349,12 +349,12 @@ public function deleteAction(Workspace $workspace) $dependentWorkspaceTitles = []; /** @var Workspace $dependentWorkspace */ foreach ($dependentWorkspaces as $dependentWorkspace) { - $dependentWorkspaceTitles[] = (string)$dependentWorkspace->workspaceTitle; + $dependentWorkspaceTitles[] = $dependentWorkspace->workspaceTitle?->value; } $message = $this->translator->translateById( 'workspaces.workspaceCannotBeDeletedBecauseOfDependencies', - [(string)$workspace->workspaceTitle, implode(', ', $dependentWorkspaceTitles)], + [$workspace->workspaceTitle?->value, implode(', ', $dependentWorkspaceTitles)], null, null, 'Modules', @@ -383,7 +383,7 @@ public function deleteAction(Workspace $workspace) //if ($nodesCount > 0) { $message = $this->translator->translateById( 'workspaces.workspaceCannotBeDeletedBecauseOfUnpublishedNodes', - [(string)$workspace->workspaceTitle, $nodesCount], + [$workspace->workspaceTitle?->value, $nodesCount], $nodesCount, null, 'Modules', @@ -396,7 +396,7 @@ public function deleteAction(Workspace $workspace) //$this->workspaceFinder->remove($workspace); $this->addFlashMessage($this->translator->translateById( 'workspaces.workspaceHasBeenRemoved', - [(string)$workspace->workspaceTitle], + [$workspace->workspaceTitle?->value], null, null, 'Modules', @@ -503,7 +503,7 @@ public function publishNodeAction(string $nodeAddress, WorkspaceName $selectedWo 'Modules', 'Neos.Neos' ) ?: 'workspaces.selectedChangeHasBeenPublished'); - $this->redirect('show', null, null, ['workspace' => $selectedWorkspace->jsonSerialize()]); + $this->redirect('show', null, null, ['workspace' => $selectedWorkspace->value]); } /** @@ -541,7 +541,7 @@ public function discardNodeAction(string $nodeAddress, WorkspaceName $selectedWo 'Modules', 'Neos.Neos' ) ?: 'workspaces.selectedChangeHasBeenDiscarded'); - $this->redirect('show', null, null, ['workspace' => $selectedWorkspace->jsonSerialize()]); + $this->redirect('show', null, null, ['workspace' => $selectedWorkspace->value]); } /** @@ -615,7 +615,7 @@ public function publishOrDiscardNodesAction(array $nodes, string $action, string throw new \RuntimeException('Invalid action "' . htmlspecialchars($action) . '" given.', 1346167441); } - $this->redirect('show', null, null, ['workspace' => $selectedWorkspace->name]); + $this->redirect('show', null, null, ['workspace' => $selectedWorkspace->value]); } /** @@ -638,8 +638,8 @@ public function publishWorkspaceAction(WorkspaceName $workspace): void $this->addFlashMessage($this->translator->translateById( 'workspaces.allChangesInWorkspaceHaveBeenPublished', [ - htmlspecialchars($workspace->workspaceName->name), - htmlspecialchars($baseWorkspaceName->name) + htmlspecialchars($workspace->workspaceName->value), + htmlspecialchars($baseWorkspaceName->value) ], null, null, @@ -667,7 +667,7 @@ public function discardWorkspaceAction(WorkspaceName $workspace): void $this->addFlashMessage($this->translator->translateById( 'workspaces.allChangesInWorkspaceHaveBeenDiscarded', - [htmlspecialchars($workspace->name)], + [htmlspecialchars($workspace->value)], null, null, 'Modules', @@ -736,7 +736,7 @@ protected function computeSiteChanges(Workspace $selectedWorkspace, ContentRepos $node = $subgraph->findNodeById($change->nodeAggregateId); if ($node) { - $pathParts = explode('/', (string)$subgraph->retrieveNodePath($node->nodeAggregateId)); + $pathParts = explode('/', $subgraph->retrieveNodePath($node->nodeAggregateId)->value); if (count($pathParts) > 2) { $siteNodeName = $pathParts[2]; $document = null; @@ -757,12 +757,12 @@ protected function computeSiteChanges(Workspace $selectedWorkspace, ContentRepos assert($document instanceof Node); $documentPath = implode('/', array_slice(explode( '/', - (string)$subgraph->retrieveNodePath($document->nodeAggregateId) + $subgraph->retrieveNodePath($document->nodeAggregateId)->value ), 3)); $relativePath = str_replace( sprintf('//%s/%s', $siteNodeName, $documentPath), '', - (string)$subgraph->retrieveNodePath($node->nodeAggregateId) + $subgraph->retrieveNodePath($node->nodeAggregateId)->value ); if (!isset($siteChanges[$siteNodeName]['siteNode'])) { $siteChanges[$siteNodeName]['siteNode'] @@ -1017,7 +1017,7 @@ protected function postProcessDiffArray(array &$diffArray): void * * @param ContentRepository $contentRepository * @param Workspace|null $excludedWorkspace - * @return array + * @return array */ protected function prepareBaseWorkspaceOptions( ContentRepository $contentRepository, @@ -1036,7 +1036,7 @@ protected function prepareBaseWorkspaceOptions( || $this->domainUserService->currentUserCanManageWorkspace($workspace)) && (!$excludedWorkspace || $workspaces->getBaseWorkspaces($workspace->workspaceName)->get($excludedWorkspace->workspaceName) === null) ) { - $baseWorkspaceOptions[(string)$workspace->workspaceName] = (string)$workspace->workspaceTitle; + $baseWorkspaceOptions[$workspace->workspaceName->value] = $workspace->workspaceTitle?->value; } } diff --git a/Neos.Neos/Classes/Controller/Service/NodesController.php b/Neos.Neos/Classes/Controller/Service/NodesController.php index 7f10944f493..0ed79a08dfa 100644 --- a/Neos.Neos/Classes/Controller/Service/NodesController.php +++ b/Neos.Neos/Classes/Controller/Service/NodesController.php @@ -402,7 +402,7 @@ protected function adoptNodeAndParents( // so we need to load it from the source subgraph $sourceNode = $sourceSubgraph->findNodeById($identifier); if (!$sourceNode) { - throw new \RuntimeException('Source node for Node Aggregate ID ' . $identifier + throw new \RuntimeException('Source node for Node Aggregate ID ' . $identifier->value . ' not found. This should never happen.', 1660905374); } $contentRepository->handle( diff --git a/Neos.Neos/Classes/Domain/Exception/SiteNodeNameIsAlreadyInUseByAnotherSite.php b/Neos.Neos/Classes/Domain/Exception/SiteNodeNameIsAlreadyInUseByAnotherSite.php index 8703b153694..3644bacb085 100644 --- a/Neos.Neos/Classes/Domain/Exception/SiteNodeNameIsAlreadyInUseByAnotherSite.php +++ b/Neos.Neos/Classes/Domain/Exception/SiteNodeNameIsAlreadyInUseByAnotherSite.php @@ -23,7 +23,7 @@ final class SiteNodeNameIsAlreadyInUseByAnotherSite extends \DomainException public static function butWasAttemptedToBeClaimed(NodeName $nodeName): self { return new self( - 'Site node name ' . $nodeName . ' is already in use by another site', + 'Site node name ' . $nodeName->value . ' is already in use by another site', 1651962963 ); } diff --git a/Neos.Neos/Classes/Domain/Exception/SiteNodeTypeIsInvalid.php b/Neos.Neos/Classes/Domain/Exception/SiteNodeTypeIsInvalid.php index ea0e02e108b..ed29ca17d87 100644 --- a/Neos.Neos/Classes/Domain/Exception/SiteNodeTypeIsInvalid.php +++ b/Neos.Neos/Classes/Domain/Exception/SiteNodeTypeIsInvalid.php @@ -24,8 +24,8 @@ final class SiteNodeTypeIsInvalid extends \DomainException public static function becauseItIsNotOfTypeSite(NodeTypeName $attemptedNodeTypeName): self { return new self( - 'Node type name "' . $attemptedNodeTypeName - . '" is not of required type "' . NodeTypeNameFactory::forSite() . '"', + 'Node type name "' . $attemptedNodeTypeName->value + . '" is not of required type "' . NodeTypeNameFactory::forSite()->value . '"', 1412372375 ); } diff --git a/Neos.Neos/Classes/Domain/Exception/SitesNodeIsMissing.php b/Neos.Neos/Classes/Domain/Exception/SitesNodeIsMissing.php index e94da263eab..ee2cea42256 100644 --- a/Neos.Neos/Classes/Domain/Exception/SitesNodeIsMissing.php +++ b/Neos.Neos/Classes/Domain/Exception/SitesNodeIsMissing.php @@ -23,7 +23,7 @@ final class SitesNodeIsMissing extends \DomainException public static function butWasRequested(): self { return new self( - 'The "' . NodeTypeNameFactory::forSites() . '" root node is missing.', + 'The "' . NodeTypeNameFactory::forSites()->value . '" root node is missing.', 1651956364 ); } diff --git a/Neos.Neos/Classes/Domain/Model/SiteNodeName.php b/Neos.Neos/Classes/Domain/Model/SiteNodeName.php index 8e9eb749dc8..0adacb9ae3c 100644 --- a/Neos.Neos/Classes/Domain/Model/SiteNodeName.php +++ b/Neos.Neos/Classes/Domain/Model/SiteNodeName.php @@ -33,7 +33,7 @@ private function __construct( public static function fromNodeName(NodeName $siteNodeName): self { - return new self($siteNodeName->jsonSerialize()); + return new self($siteNodeName->value); } public static function fromString(string $siteNodeName): self diff --git a/Neos.Neos/Classes/Domain/Service/FusionService.php b/Neos.Neos/Classes/Domain/Service/FusionService.php index ab2b1c08318..2cb588630be 100644 --- a/Neos.Neos/Classes/Domain/Service/FusionService.php +++ b/Neos.Neos/Classes/Domain/Service/FusionService.php @@ -165,7 +165,10 @@ public function getMergedFusionObjectTree(Node $startNode) protected function getSiteForSiteNode(Node $siteNode): ?Site { - return $this->siteRepository->findOneByNodeName((string)$siteNode->nodeName); + if ($siteNode->nodeName === null) { + return null; + } + return $this->siteRepository->findOneByNodeName($siteNode->nodeName->value); } /** diff --git a/Neos.Neos/Classes/Domain/Service/SiteService.php b/Neos.Neos/Classes/Domain/Service/SiteService.php index 82664e3a7a6..0905b12d9d2 100644 --- a/Neos.Neos/Classes/Domain/Service/SiteService.php +++ b/Neos.Neos/Classes/Domain/Service/SiteService.php @@ -127,7 +127,10 @@ public function assignUploadedAssetToSiteAssetCollection(Asset $asset, Node $nod return; } - $site = $this->siteRepository->findOneByNodeName((string)$siteNode->nodeName); + if ($siteNode->nodeName === null) { + return; + } + $site = $this->siteRepository->findOneByNodeName($siteNode->nodeName->value); if ($site === null) { return; } @@ -159,12 +162,12 @@ public function createSite( ): Site { $siteNodeName = NodeName::fromString($nodeName ?: $siteName); - if ($this->siteRepository->findOneByNodeName($siteNodeName->jsonSerialize())) { + if ($this->siteRepository->findOneByNodeName($siteNodeName->value)) { throw SiteNodeNameIsAlreadyInUseByAnotherSite::butWasAttemptedToBeClaimed($siteNodeName); } // @todo use node aggregate identifier instead of node name - $site = new Site((string)$siteNodeName); + $site = new Site($siteNodeName->value); $site->setSiteResourcesPackageKey($packageKey); $site->setState($inactive ? Site::STATE_OFFLINE : Site::STATE_ONLINE); $site->setName($siteName); diff --git a/Neos.Neos/Classes/Domain/Service/SiteServiceInternals.php b/Neos.Neos/Classes/Domain/Service/SiteServiceInternals.php index b06570e99df..9ad9261ce83 100644 --- a/Neos.Neos/Classes/Domain/Service/SiteServiceInternals.php +++ b/Neos.Neos/Classes/Domain/Service/SiteServiceInternals.php @@ -59,7 +59,7 @@ public function removeSiteNode(SiteNodeName $siteNodeName): void $arbitraryDimensionSpacePoint = reset($dimensionSpacePoints) ?: null; if (!$arbitraryDimensionSpacePoint instanceof DimensionSpacePoint) { throw new \InvalidArgumentException( - 'Cannot prune site "' . $siteNodeName->toNodeName() + 'Cannot prune site "' . $siteNodeName->toNodeName()->value . '" due to the dimension space being empty', 1651921482 ); diff --git a/Neos.Neos/Classes/Domain/Service/UserService.php b/Neos.Neos/Classes/Domain/Service/UserService.php index 80b9dc10c17..6edd9b5332f 100644 --- a/Neos.Neos/Classes/Domain/Service/UserService.php +++ b/Neos.Neos/Classes/Domain/Service/UserService.php @@ -685,7 +685,7 @@ public function deactivateUser(User $user): void */ public function currentUserCanPublishToWorkspace(Workspace $workspace): bool { - if ($workspace->workspaceName->jsonSerialize() === 'live') { + if ($workspace->workspaceName->isLive()) { return $this->securityContext->hasRole('Neos.Neos:LivePublisher'); } diff --git a/Neos.Neos/Classes/Eel/FlowQueryOperations/SortOperation.php b/Neos.Neos/Classes/Eel/FlowQueryOperations/SortOperation.php index fe2b857a95c..4f63e806a84 100644 --- a/Neos.Neos/Classes/Eel/FlowQueryOperations/SortOperation.php +++ b/Neos.Neos/Classes/Eel/FlowQueryOperations/SortOperation.php @@ -123,8 +123,8 @@ public function evaluate(FlowQuery $flowQuery, array $arguments) $propertyValue = $propertyValue->getTimestamp(); } - $sortSequence[(string)$node->nodeAggregateId] = $propertyValue; - $nodesByIdentifier[(string)$node->nodeAggregateId] = $node; + $sortSequence[$node->nodeAggregateId->value] = $propertyValue; + $nodesByIdentifier[$node->nodeAggregateId->value] = $node; } // Create the sort sequence diff --git a/Neos.Neos/Classes/FrontendRouting/DimensionResolution/Resolver/UriPathResolver.php b/Neos.Neos/Classes/FrontendRouting/DimensionResolution/Resolver/UriPathResolver.php index 5c4baafaac1..ac156ea9451 100644 --- a/Neos.Neos/Classes/FrontendRouting/DimensionResolution/Resolver/UriPathResolver.php +++ b/Neos.Neos/Classes/FrontendRouting/DimensionResolution/Resolver/UriPathResolver.php @@ -85,7 +85,7 @@ private static function validate( $contentDimension = $contentDimensionSource->getDimension($segment->dimensionIdentifier); if ($contentDimension === null) { throw new UriPathResolverConfigurationException( - 'Content Dimension "' . $segment->dimensionIdentifier . '" does not exist.' + 'Content Dimension "' . $segment->dimensionIdentifier->value . '" does not exist.' ); } @@ -93,7 +93,7 @@ private static function validate( if ($contentDimension->getValue($mappingElement->dimensionValue->value) === null) { throw new UriPathResolverConfigurationException( 'Content Dimension Value "' . $mappingElement->dimensionValue->value - . '" in dimension "' . $segment->dimensionIdentifier->id . '" does not exist.' + . '" in dimension "' . $segment->dimensionIdentifier->value . '" does not exist.' ); } @@ -133,7 +133,7 @@ private static function calculateUriPaths(Segments $segments, Separator $separat if (isset($uriPathToDimensionSpacePoint[$uriPathSegment])) { throw new UriPathResolverConfigurationException( 'Uri path segment "' . $uriPathSegment - . '" already configured by dimension ' . $uriPathToDimensionSpacePoint[$uriPathSegment] + . '" already configured by dimension ' . $uriPathToDimensionSpacePoint[$uriPathSegment]->toJson() . '. Thus, we cannot use it for dimension ' . json_encode($dimensionSpacePointCoordinates) ); } @@ -159,7 +159,7 @@ private static function cartesian(Segments $segments): array foreach ($result as $product) { foreach ($segment->uriPathSegmentMapping as $item) { - $product[$segment->dimensionIdentifier->id] = $item; + $product[$segment->dimensionIdentifier->value] = $item; $append[] = $product; } } @@ -244,7 +244,7 @@ private function reduceDimensionSpacePointToConfiguredDimensions(DimensionSpaceP foreach ($this->segments->segments as $segment) { $coordinateValue = $incoming->getCoordinate($segment->dimensionIdentifier); if ($coordinateValue !== null) { - $newCoordinates[$segment->dimensionIdentifier->id] = $coordinateValue; + $newCoordinates[$segment->dimensionIdentifier->value] = $coordinateValue; } } return DimensionSpacePoint::fromArray($newCoordinates); diff --git a/Neos.Neos/Classes/FrontendRouting/NodeAddress.php b/Neos.Neos/Classes/FrontendRouting/NodeAddress.php index dc78d0bcd95..02425474659 100644 --- a/Neos.Neos/Classes/FrontendRouting/NodeAddress.php +++ b/Neos.Neos/Classes/FrontendRouting/NodeAddress.php @@ -61,9 +61,9 @@ public function serializeForUri(): string { // the reverse method is {@link NodeAddressFactory::createFromUriString} - ensure to adjust it // when changing the serialization here - return $this->workspaceName->name + return $this->workspaceName->value . '__' . base64_encode(json_encode($this->dimensionSpacePoint->coordinates, JSON_THROW_ON_ERROR)) - . '__' . $this->nodeAggregateId->jsonSerialize(); + . '__' . $this->nodeAggregateId->value; } public function isInLiveWorkspace(): bool @@ -75,10 +75,10 @@ public function __toString(): string { return sprintf( 'NodeAddress[contentStream=%s, dimensionSpacePoint=%s, nodeAggregateId=%s, workspaceName=%s]', - $this->contentStreamId, - $this->dimensionSpacePoint, - $this->nodeAggregateId, - $this->workspaceName + $this->contentStreamId->value, + $this->dimensionSpacePoint->toJson(), + $this->nodeAggregateId->value, + $this->workspaceName->value ); } } diff --git a/Neos.Neos/Classes/FrontendRouting/NodeAddressFactory.php b/Neos.Neos/Classes/FrontendRouting/NodeAddressFactory.php index 138fc9172c8..e1328d8c1c4 100644 --- a/Neos.Neos/Classes/FrontendRouting/NodeAddressFactory.php +++ b/Neos.Neos/Classes/FrontendRouting/NodeAddressFactory.php @@ -43,8 +43,8 @@ public function createFromNode(Node $node): NodeAddress ); if ($workspace === null) { throw new \RuntimeException( - 'Cannot build a NodeAddress for traversable node of aggregate ' . $node->nodeAggregateId - . ', because the content stream ' . $node->subgraphIdentity->contentStreamId + 'Cannot build a NodeAddress for traversable node of aggregate ' . $node->nodeAggregateId->value + . ', because the content stream ' . $node->subgraphIdentity->contentStreamId->value . ' is not assigned to a workspace.' ); } diff --git a/Neos.Neos/Classes/FrontendRouting/NodeShortcutResolver.php b/Neos.Neos/Classes/FrontendRouting/NodeShortcutResolver.php index 1be565807ca..d1d6ad5b679 100644 --- a/Neos.Neos/Classes/FrontendRouting/NodeShortcutResolver.php +++ b/Neos.Neos/Classes/FrontendRouting/NodeShortcutResolver.php @@ -113,14 +113,14 @@ public function resolveNode( throw new InvalidShortcutException(sprintf( 'Shortcut Node "%s" points to a non-existing parent node "%s"', $documentNodeInfo, - $documentNodeInfo->getNodeAggregateId() + $documentNodeInfo->getNodeAggregateId()->value ), 1599669406, $e); } if ($documentNodeInfo->isDisabled()) { throw new InvalidShortcutException(sprintf( 'Shortcut Node "%s" points to disabled parent node "%s"', $documentNodeInfo, - $documentNodeInfo->getNodeAggregateId() + $documentNodeInfo->getNodeAggregateId()->value ), 1599664517); } continue 2; @@ -166,7 +166,7 @@ public function resolveNode( throw new InvalidShortcutException(sprintf( 'Shortcut target in Node "%s" points to disabled node "%s"', $documentNodeInfo, - $documentNodeInfo->getNodeAggregateId() + $documentNodeInfo->getNodeAggregateId()->value ), 1599664423); } continue 2; diff --git a/Neos.Neos/Classes/FrontendRouting/Projection/DocumentUriPathFinder.php b/Neos.Neos/Classes/FrontendRouting/Projection/DocumentUriPathFinder.php index 08da130683d..e7d3bcb8bc9 100644 --- a/Neos.Neos/Classes/FrontendRouting/Projection/DocumentUriPathFinder.php +++ b/Neos.Neos/Classes/FrontendRouting/Projection/DocumentUriPathFinder.php @@ -47,7 +47,11 @@ public function getEnabledBySiteNodeNameUriPathAndDimensionSpacePointHash( AND siteNodeName = :siteNodeName AND uriPath = :uriPath AND disabled = 0', - compact('dimensionSpacePointHash', 'siteNodeName', 'uriPath') + [ + 'dimensionSpacePointHash' => $dimensionSpacePointHash, + 'siteNodeName' => $siteNodeName->value, + 'uriPath' => $uriPath, + ] ); } @@ -70,7 +74,10 @@ public function getByIdAndDimensionSpacePointHash( return $this->fetchSingle( 'nodeAggregateId = :nodeAggregateId AND dimensionSpacePointHash = :dimensionSpacePointHash', - compact('nodeAggregateId', 'dimensionSpacePointHash') + [ + 'nodeAggregateId' => $nodeAggregateId->value, + 'dimensionSpacePointHash' => $dimensionSpacePointHash, + ] ); } @@ -117,11 +124,11 @@ public function getPrecedingNode( 'dimensionSpacePointHash = :dimensionSpacePointHash AND parentNodeAggregateId = :parentNodeAggregateId AND succeedingNodeAggregateId = :succeedingNodeAggregateId', - compact( - 'dimensionSpacePointHash', - 'parentNodeAggregateId', - 'succeedingNodeAggregateId' - ) + [ + 'dimensionSpacePointHash' => $dimensionSpacePointHash, + 'parentNodeAggregateId' => $parentNodeAggregateId->value, + 'succeedingNodeAggregateId' => $succeedingNodeAggregateId->value, + ] ); } @@ -145,7 +152,10 @@ public function getFirstEnabledChildNode( AND parentNodeAggregateId = :parentNodeAggregateId AND precedingNodeAggregateId IS NULL AND disabled = 0', - compact('dimensionSpacePointHash', 'parentNodeAggregateId') + [ + 'dimensionSpacePointHash' => $dimensionSpacePointHash, + 'parentNodeAggregateId' => $parentNodeAggregateId->value, + ] ); } @@ -164,7 +174,10 @@ public function getLastChildNode( 'dimensionSpacePointHash = :dimensionSpacePointHash AND parentNodeAggregateId = :parentNodeAggregateId AND succeedingNodeAggregateId IS NULL', - compact('dimensionSpacePointHash', 'parentNodeAggregateId') + [ + 'dimensionSpacePointHash' => $dimensionSpacePointHash, + 'parentNodeAggregateId' => $parentNodeAggregateId->value, + ] ); } @@ -207,7 +220,7 @@ private function fetchSingle(string $where, array $parameters): DocumentNodeInfo # NOTE: "LIMIT 1" in the following query is just a performance optimization # since Connection::fetchAssoc() only returns the first result anyways try { - $row = $this->dbal->fetchAssoc( + $row = $this->dbal->fetchAssociative( 'SELECT * FROM ' . $this->tableNamePrefix . '_uri WHERE ' . $where . ' LIMIT 1', $parameters, diff --git a/Neos.Neos/Classes/FrontendRouting/Projection/DocumentUriPathProjection.php b/Neos.Neos/Classes/FrontendRouting/Projection/DocumentUriPathProjection.php index b097fe55cf3..8501f622178 100644 --- a/Neos.Neos/Classes/FrontendRouting/Projection/DocumentUriPathProjection.php +++ b/Neos.Neos/Classes/FrontendRouting/Projection/DocumentUriPathProjection.php @@ -201,13 +201,13 @@ private function whenRootWorkspaceWasCreated(RootWorkspaceWasCreated $event): vo { try { $this->dbal->insert($this->tableNamePrefix . '_livecontentstreams', [ - 'contentStreamId' => $event->newContentStreamId, - 'workspaceName' => $event->workspaceName, + 'contentStreamId' => $event->newContentStreamId->value, + 'workspaceName' => $event->workspaceName->value, ]); } catch (DBALException $e) { throw new \RuntimeException(sprintf( 'Failed to insert root content stream id of the root workspace "%s": %s', - $event->workspaceName, + $event->workspaceName->value, $e->getMessage() ), 1599646608, $e); } @@ -221,9 +221,9 @@ private function whenRootNodeAggregateWithNodeWasCreated(RootNodeAggregateWithNo foreach ($event->coveredDimensionSpacePoints as $dimensionSpacePoint) { $this->insertNode([ 'uriPath' => '', - 'nodeAggregateIdPath' => $event->nodeAggregateId, + 'nodeAggregateIdPath' => $event->nodeAggregateId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash, - 'nodeAggregateId' => $event->nodeAggregateId, + 'nodeAggregateId' => $event->nodeAggregateId->value, ]); } } @@ -237,16 +237,16 @@ private function whenRootNodeAggregateDimensionsWereUpdated(RootNodeAggregateDim $this->dbal->delete( $this->tableNamePrefix . '_uri', [ - 'nodeAggregateId' => $event->nodeAggregateId + 'nodeAggregateId' => $event->nodeAggregateId->value ] ); foreach ($event->coveredDimensionSpacePoints as $dimensionSpacePoint) { $this->insertNode([ 'uriPath' => '', - 'nodeAggregateIdPath' => $event->nodeAggregateId, + 'nodeAggregateIdPath' => $event->nodeAggregateId->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash, - 'nodeAggregateId' => $event->nodeAggregateId, + 'nodeAggregateId' => $event->nodeAggregateId->value, ]); } } @@ -292,7 +292,7 @@ private function whenNodeAggregateWithNodeWasCreated(NodeAggregateWithNodeWasCre // make the new node the new succeeding node of the previously last child // (= insert at the end of all children) $this->updateNode($precedingNode, [ - 'succeedingNodeAggregateId' => $event->nodeAggregateId + 'succeedingNodeAggregateId' => $event->nodeAggregateId->value ]); } } else { @@ -305,18 +305,18 @@ private function whenNodeAggregateWithNodeWasCreated(NodeAggregateWithNodeWasCre // make the new node the new succeeding node of the previously preceding node // of the specified succeeding node (= re-wire - to -) $this->updateNode($precedingNode, [ - 'succeedingNodeAggregateId' => $event->nodeAggregateId + 'succeedingNodeAggregateId' => $event->nodeAggregateId->value ]); } $this->updateNodeByIdAndDimensionSpacePointHash( $event->succeedingNodeAggregateId, $dimensionSpacePoint->hash, - ['precedingNodeAggregateId' => $event->nodeAggregateId] + ['precedingNodeAggregateId' => $event->nodeAggregateId->value] ); } $nodeAggregateIdPath = $parentNode->getNodeAggregateIdPath() - . '/' . $event->nodeAggregateId; + . '/' . $event->nodeAggregateId->value; if ($parentNode->isRoot() && $event->nodeName !== null) { $uriPath = ''; $siteNodeName = SiteNodeName::fromNodeName($event->nodeName); @@ -327,15 +327,15 @@ private function whenNodeAggregateWithNodeWasCreated(NodeAggregateWithNodeWasCre $siteNodeName = $parentNode->getSiteNodeName(); } $this->insertNode([ - 'nodeAggregateId' => $event->nodeAggregateId, + 'nodeAggregateId' => $event->nodeAggregateId->value, 'uriPath' => $uriPath, 'nodeAggregateIdPath' => $nodeAggregateIdPath, - 'siteNodeName' => $siteNodeName, + 'siteNodeName' => $siteNodeName->value, 'dimensionSpacePointHash' => $dimensionSpacePoint->hash, 'originDimensionSpacePointHash' => $event->originDimensionSpacePoint->hash, - 'parentNodeAggregateId' => $parentNode->getNodeAggregateId(), - 'precedingNodeAggregateId' => $precedingNode?->getNodeAggregateId(), - 'succeedingNodeAggregateId' => $event->succeedingNodeAggregateId, + 'parentNodeAggregateId' => $parentNode->getNodeAggregateId()->value, + 'precedingNodeAggregateId' => $precedingNode?->getNodeAggregateId()->value, + 'succeedingNodeAggregateId' => $event->succeedingNodeAggregateId?->value, 'shortcutTarget' => $shortcutTarget, ]); } @@ -352,13 +352,13 @@ private function whenNodeAggregateTypeWasChanged(NodeAggregateTypeWasChanged $ev $this->updateNodeQuery('SET shortcuttarget = \'{"mode":"firstChildNode","target":null}\' WHERE nodeAggregateId = :nodeAggregateId AND shortcuttarget IS NULL', [ - 'nodeAggregateId' => $event->nodeAggregateId, + 'nodeAggregateId' => $event->nodeAggregateId->value, ]); } elseif ($this->isDocumentNodeType($event->newNodeTypeName)) { $this->updateNodeQuery('SET shortcuttarget = NULL WHERE nodeAggregateId = :nodeAggregateId AND shortcuttarget IS NOT NULL', [ - 'nodeAggregateId' => $event->nodeAggregateId, + 'nodeAggregateId' => $event->nodeAggregateId->value, ]); } } @@ -455,7 +455,7 @@ private function whenNodeAggregateWasDisabled(NodeAggregateWasDisabled $event): OR nodeAggregateIdPath LIKE :childNodeAggregateIdPathPrefix )', [ 'dimensionSpacePointHash' => $dimensionSpacePoint->hash, - 'nodeAggregateId' => $event->nodeAggregateId, + 'nodeAggregateId' => $event->nodeAggregateId->value, 'childNodeAggregateIdPathPrefix' => $node->getNodeAggregateIdPath() . '/%', ]); } @@ -486,7 +486,7 @@ private function whenNodeAggregateWasEnabled(NodeAggregateWasEnabled $event): vo OR nodeAggregateIdPath LIKE :childNodeAggregateIdPathPrefix )', [ 'dimensionSpacePointHash' => $dimensionSpacePoint->hash, - 'nodeAggregateId' => $node->getNodeAggregateId(), + 'nodeAggregateId' => $node->getNodeAggregateId()->value, 'childNodeAggregateIdPathPrefix' => $node->getNodeAggregateIdPath() . '/%', ]); } @@ -515,7 +515,7 @@ private function whenNodeAggregateWasRemoved(NodeAggregateWasRemoved $event): vo OR nodeAggregateIdPath LIKE :childNodeAggregateIdPathPrefix )', [ 'dimensionSpacePointHash' => $dimensionSpacePoint->hash, - 'nodeAggregateId' => $node->getNodeAggregateId(), + 'nodeAggregateId' => $node->getNodeAggregateId()->value, 'childNodeAggregateIdPathPrefix' => $node->getNodeAggregateIdPath() . '/%', ]); } @@ -584,7 +584,7 @@ private function whenNodePropertiesWereSet(NodePropertiesWereSet $event, EventEn 'newUriPath' => $newUriPath, 'oldUriPath' => $oldUriPath, 'dimensionSpacePointHash' => $event->originDimensionSpacePoint->hash, - 'nodeAggregateId' => $node->getNodeAggregateId(), + 'nodeAggregateId' => $node->getNodeAggregateId()->value, 'childNodeAggregateIdPathPrefix' => $node->getNodeAggregateIdPath() . '/%', ] ); @@ -666,7 +666,7 @@ private function moveNode( ', /** @codingStandardsIgnoreEnd */ [ - 'nodeAggregateId' => $node->getNodeAggregateId(), + 'nodeAggregateId' => $node->getNodeAggregateId()->value, 'newParentNodeAggregateIdPath' => $newParentNode->getNodeAggregateIdPath(), 'sourceNodeAggregateIdPathOffset' => (int)strrpos($node->getNodeAggregateIdPath(), '/') + 1, @@ -736,7 +736,7 @@ private function tryGetNode(\Closure $closure): ?DocumentNodeInfo try { return $closure(); } catch (NodeNotFoundException $_) { - /** @noinspection BadExceptionsProcessingInspection,PhpRedundantCatchClauseInspection */ + /** @noinspection BadExceptionsProcessingInspection */ return null; } } @@ -777,13 +777,16 @@ private function updateNodeByIdAndDimensionSpacePointHash( $this->dbal->update( $this->tableNamePrefix . '_uri', $data, - compact('nodeAggregateId', 'dimensionSpacePointHash'), + [ + 'nodeAggregateId' => $nodeAggregateId->value, + 'dimensionSpacePointHash' => $dimensionSpacePointHash, + ], self::COLUMN_TYPES_DOCUMENT_URIS ); } catch (DBALException $e) { throw new \RuntimeException(sprintf( 'Failed to update node "%s": %s', - $nodeAggregateId, + $nodeAggregateId->value, $e->getMessage() ), 1599646777, $e); } @@ -815,13 +818,16 @@ private function deleteNodeByIdAndDimensionSpacePointHash( try { $this->dbal->delete( $this->tableNamePrefix . '_uri', - compact('nodeAggregateId', 'dimensionSpacePointHash'), + [ + 'nodeAggregateId' => $nodeAggregateId->value, + 'dimensionSpacePointHash' => $dimensionSpacePointHash, + ], self::COLUMN_TYPES_DOCUMENT_URIS ); } catch (DBALException $e) { throw new \RuntimeException(sprintf( 'Failed to delete node "%s": %s', - $nodeAggregateId, + $nodeAggregateId->value, $e->getMessage() ), 1599655284, $e); } @@ -853,7 +859,7 @@ private function disconnectNodeFromSiblings(DocumentNodeInfo $node): void $node->getPrecedingNodeAggregateId(), $node->getDimensionSpacePointHash(), ['succeedingNodeAggregateId' => - $node->hasSucceedingNodeAggregateId() ? $node->getSucceedingNodeAggregateId() : null + $node->hasSucceedingNodeAggregateId() ? $node->getSucceedingNodeAggregateId()->value : null ] ); } @@ -862,7 +868,7 @@ private function disconnectNodeFromSiblings(DocumentNodeInfo $node): void $node->getSucceedingNodeAggregateId(), $node->getDimensionSpacePointHash(), ['precedingNodeAggregateId' => - $node->hasPrecedingNodeAggregateId() ? $node->getPrecedingNodeAggregateId() : null + $node->hasPrecedingNodeAggregateId() ? $node->getPrecedingNodeAggregateId()->value : null ] ); } @@ -884,7 +890,7 @@ private function connectNodeWithSiblings( $this->updateNodeByIdAndDimensionSpacePointHash( $newSucceedingNodeAggregateId, $node->getDimensionSpacePointHash(), - ['precedingNodeAggregateId' => $node->getNodeAggregateId()] + ['precedingNodeAggregateId' => $node->getNodeAggregateId()->value] ); } else { $newPrecedingNode = $this->tryGetNode(fn () => $this->getState()->getLastChildNode( @@ -895,15 +901,15 @@ private function connectNodeWithSiblings( if ($newPrecedingNode !== null) { $this->updateNode( $newPrecedingNode, - ['succeedingNodeAggregateId' => $node->getNodeAggregateId()] + ['succeedingNodeAggregateId' => $node->getNodeAggregateId()->value] ); } // update node itself $this->updateNode($node, [ - 'parentNodeAggregateId' => $parentNodeAggregateId, - 'precedingNodeAggregateId' => $newPrecedingNode?->getNodeAggregateId(), - 'succeedingNodeAggregateId' => $newSucceedingNodeAggregateId, + 'parentNodeAggregateId' => $parentNodeAggregateId->value, + 'precedingNodeAggregateId' => $newPrecedingNode?->getNodeAggregateId()->value, + 'succeedingNodeAggregateId' => $newSucceedingNodeAggregateId?->value, ]); } diff --git a/Neos.Neos/Classes/FrontendRouting/Projection/DocumentUriPathProjectionFactory.php b/Neos.Neos/Classes/FrontendRouting/Projection/DocumentUriPathProjectionFactory.php index f744d6ea8fe..ed35828c8f2 100644 --- a/Neos.Neos/Classes/FrontendRouting/Projection/DocumentUriPathProjectionFactory.php +++ b/Neos.Neos/Classes/FrontendRouting/Projection/DocumentUriPathProjectionFactory.php @@ -32,7 +32,7 @@ public static function projectionTableNamePrefix( ) ); - return sprintf('cr_%s_p_neos_%s', $contentRepositoryId, $projectionShortName); + return sprintf('cr_%s_p_neos_%s', $contentRepositoryId->value, $projectionShortName); } diff --git a/Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php b/Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php index 4282800d840..71a64e4a356 100644 --- a/Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php +++ b/Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php @@ -114,20 +114,20 @@ public function flushNodeAggregate( } $processedNodeAggregateIds[$nodeAggregate->nodeAggregateId->value] = true; - $tagName = 'DescendantOf_%' . $nodeAggregate->contentStreamId - . '%_' . $nodeAggregate->nodeAggregateId; + $tagName = 'DescendantOf_%' . $nodeAggregate->contentStreamId->value + . '%_' . $nodeAggregate->nodeAggregateId->value; $tagsToFlush[$tagName] = sprintf( 'which were tagged with "%s" because node "%s" has changed.', $tagName, - $nodeAggregate->nodeAggregateId + $nodeAggregate->nodeAggregateId->value ); // Legacy - $legacyTagName = 'DescendantOf_' . $nodeAggregate->nodeAggregateId; + $legacyTagName = 'DescendantOf_' . $nodeAggregate->nodeAggregateId->value; $tagsToFlush[$legacyTagName] = sprintf( 'which were tagged with legacy "%s" because node "%s" has changed.', $legacyTagName, - $nodeAggregate->nodeAggregateId + $nodeAggregate->nodeAggregateId->value ); foreach ( @@ -156,7 +156,7 @@ private function registerChangeOnNodeIdentifier( NodeAggregateId $nodeAggregateId, array &$tagsToFlush ): void { - $cacheIdentifier = '%' . $contentStreamId . '%_' . $nodeAggregateId; + $cacheIdentifier = '%' . $contentStreamId->value . '%_' . $nodeAggregateId->value; $tagsToFlush['Node_' . $cacheIdentifier] = sprintf( 'which were tagged with "Node_%s" because that identifier has changed.', $cacheIdentifier @@ -169,7 +169,7 @@ private function registerChangeOnNodeIdentifier( ); // Legacy - $cacheIdentifier = (string)$nodeAggregateId; + $cacheIdentifier = $nodeAggregateId->value; $tagsToFlush['Node_' . $cacheIdentifier] = sprintf( 'which were tagged with "Node_%s" because that identifier has changed.', $cacheIdentifier @@ -198,27 +198,27 @@ private function registerChangeOnNodeType( ): void { try { $nodeTypesToFlush = $this->getAllImplementedNodeTypeNames( - $contentRepository->getNodeTypeManager()->getNodeType((string)$nodeTypeName) + $contentRepository->getNodeTypeManager()->getNodeType($nodeTypeName->value) ); } catch (NodeTypeNotFoundException $e) { // as a fallback, we flush the single NodeType - $nodeTypesToFlush = [(string)$nodeTypeName]; + $nodeTypesToFlush = [$nodeTypeName->value]; } foreach ($nodeTypesToFlush as $nodeTypeNameToFlush) { - $tagsToFlush['NodeType_%' . $contentStreamId . '%_' . $nodeTypeNameToFlush] = sprintf( + $tagsToFlush['NodeType_%' . $contentStreamId->value . '%_' . $nodeTypeNameToFlush] = sprintf( 'which were tagged with "NodeType_%s" because node "%s" has changed and was of type "%s".', $nodeTypeNameToFlush, - ($referenceNodeIdentifier ?: ''), - $nodeTypeName + ($referenceNodeIdentifier?->value ?? ''), + $nodeTypeName->value ); // Legacy, but still used $tagsToFlush['NodeType_' . $nodeTypeNameToFlush] = sprintf( 'which were tagged with "NodeType_%s" because node "%s" has changed and was of type "%s".', $nodeTypeNameToFlush, - ($referenceNodeIdentifier ?: ''), - $nodeTypeName + ($referenceNodeIdentifier->value ?? ''), + $nodeTypeName->value ); } } diff --git a/Neos.Neos/Classes/Fusion/Cache/FusionCachingAspect.php b/Neos.Neos/Classes/Fusion/Cache/FusionCachingAspect.php index f4fb4f3aee6..e298c7bc0a7 100644 --- a/Neos.Neos/Classes/Fusion/Cache/FusionCachingAspect.php +++ b/Neos.Neos/Classes/Fusion/Cache/FusionCachingAspect.php @@ -40,7 +40,7 @@ public function cacheGetMergedFusionObjectTree(JoinPointInterface $joinPoint) { /* @var Node $currentSiteNode */ $currentSiteNode = $joinPoint->getMethodArgument('startNode'); - $cacheIdentifier = $currentSiteNode->nodeAggregateId->jsonSerialize(); + $cacheIdentifier = $currentSiteNode->nodeAggregateId->value; if ($this->fusionCache->has($cacheIdentifier)) { $fusionObjectTree = $this->fusionCache->get($cacheIdentifier); diff --git a/Neos.Neos/Classes/Fusion/DimensionsMenuItemsImplementation.php b/Neos.Neos/Classes/Fusion/DimensionsMenuItemsImplementation.php index 8cc772edd06..89dc4a75288 100644 --- a/Neos.Neos/Classes/Fusion/DimensionsMenuItemsImplementation.php +++ b/Neos.Neos/Classes/Fusion/DimensionsMenuItemsImplementation.php @@ -206,7 +206,7 @@ function (&$dimensionValue, $rawDimensionIdentifier) use ($dimensionMenuItemsImp protected function determineLabel(?Node $variant = null, array $metadata = []): string { if ($this->getContentDimensionIdentifierToLimitTo()) { - return $metadata[(string)$this->getContentDimensionIdentifierToLimitTo()]['label'] ?: ''; + return $metadata[$this->getContentDimensionIdentifierToLimitTo()->value]['label'] ?: ''; } else { if ($variant) { return $variant->getLabel() ?: ''; diff --git a/Neos.Neos/Classes/Fusion/Helper/CachingHelper.php b/Neos.Neos/Classes/Fusion/Helper/CachingHelper.php index f8a3e738783..1d9ed58c17c 100644 --- a/Neos.Neos/Classes/Fusion/Helper/CachingHelper.php +++ b/Neos.Neos/Classes/Fusion/Helper/CachingHelper.php @@ -63,7 +63,7 @@ protected function convertArrayOfNodesToArrayOfNodeIdentifiersWithPrefix(mixed $ if ($node instanceof Node) { $prefixedNodeIdentifiers[] = $prefix . '_' . $this->renderContentStreamIdTag($node->subgraphIdentity->contentStreamId) - . '_' . $node->nodeAggregateId; + . '_' . $node->nodeAggregateId->value; } else { throw new Exception(sprintf( 'One of the elements in array passed to this helper was not a Node, but of type: "%s".', @@ -157,7 +157,7 @@ protected function getNodeTypeTagFor($nodeType, Node $contextNode = null) $nodeTypeName .= $nodeType; } if ($nodeType instanceof NodeType) { - $nodeTypeName .= $nodeType->name; + $nodeTypeName .= $nodeType->name->value; } if ($nodeTypeName === '') { @@ -188,7 +188,7 @@ public function descendantOfTag(mixed $nodes): array */ private function renderContentStreamIdTag(ContentStreamId $contentStreamId) { - return '%' . $contentStreamId . '%'; + return '%' . $contentStreamId->value . '%'; } /** @@ -213,7 +213,7 @@ public function getWorkspaceChain(?Node $node): array $workspaceChain = []; // TODO: Maybe write CTE here while ($currentWorkspace instanceof Workspace) { - $workspaceChain[(string)$currentWorkspace->workspaceName] = $currentWorkspace; + $workspaceChain[$currentWorkspace->workspaceName->value] = $currentWorkspace; $currentWorkspace = $currentWorkspace->baseWorkspaceName ? $contentRepository->getWorkspaceFinder()->findOneByName($currentWorkspace->baseWorkspaceName) : null; diff --git a/Neos.Neos/Classes/Fusion/Helper/LinkHelper.php b/Neos.Neos/Classes/Fusion/Helper/LinkHelper.php index 8d8bd9ca8c8..ee37e635dad 100644 --- a/Neos.Neos/Classes/Fusion/Helper/LinkHelper.php +++ b/Neos.Neos/Classes/Fusion/Helper/LinkHelper.php @@ -119,7 +119,7 @@ public function resolveNodeUri( ) { $this->systemLogger->info(sprintf( 'Failed to build URI for node "%s": %e', - $targetNode->nodeAggregateId, + $targetNode->nodeAggregateId->value, $e->getMessage() ), LogEnvironment::fromMethodName(__METHOD__)); return null; diff --git a/Neos.Neos/Classes/Fusion/Helper/NodeHelper.php b/Neos.Neos/Classes/Fusion/Helper/NodeHelper.php index 6eb6432a1da..22571437bcc 100644 --- a/Neos.Neos/Classes/Fusion/Helper/NodeHelper.php +++ b/Neos.Neos/Classes/Fusion/Helper/NodeHelper.php @@ -68,9 +68,9 @@ public function nearestContentCollection(Node $node, string $nodePath): Node . ' You might want to adjust your node type configuration and create the missing child node' . ' through the "flow node:repair --node-type %s" command.', $contentCollectionType, - $nodePathOfNode, + $nodePathOfNode->value, $nodePath, - $node->nodeType + $node->nodeType->name->value ), 1389352984); } } diff --git a/Neos.Neos/Classes/Fusion/Helper/NodeLabelToken.php b/Neos.Neos/Classes/Fusion/Helper/NodeLabelToken.php index 0c236da1cc8..b68638890f4 100644 --- a/Neos.Neos/Classes/Fusion/Helper/NodeLabelToken.php +++ b/Neos.Neos/Classes/Fusion/Helper/NodeLabelToken.php @@ -145,8 +145,8 @@ protected function resolveLabelFromNodeType(): void $this->label = $this->node->nodeType->getName(); } - if (empty($this->postfix) && $this->node->classification->isTethered()) { - $this->postfix = ' (' . $this->node->nodeName . ')'; + if (empty($this->postfix) && $this->node->nodeName !== null && $this->node->classification->isTethered()) { + $this->postfix = ' (' . $this->node->nodeName->value . ')'; } } diff --git a/Neos.Neos/Classes/PendingChangesProjection/Change.php b/Neos.Neos/Classes/PendingChangesProjection/Change.php index 8f95402a915..a39952d655c 100644 --- a/Neos.Neos/Classes/PendingChangesProjection/Change.php +++ b/Neos.Neos/Classes/PendingChangesProjection/Change.php @@ -89,14 +89,14 @@ public function __construct( public function addToDatabase(Connection $databaseConnection, string $tableName): void { $databaseConnection->insert($tableName, [ - 'contentStreamId' => (string)$this->contentStreamId, - 'nodeAggregateId' => (string)$this->nodeAggregateId, - 'originDimensionSpacePoint' => json_encode($this->originDimensionSpacePoint), + 'contentStreamId' => $this->contentStreamId->value, + 'nodeAggregateId' => $this->nodeAggregateId->value, + 'originDimensionSpacePoint' => $this->originDimensionSpacePoint->toJson(), 'originDimensionSpacePointHash' => $this->originDimensionSpacePoint->hash, 'changed' => (int)$this->changed, 'moved' => (int)$this->moved, 'deleted' => (int)$this->deleted, - 'removalAttachmentPoint' => $this->removalAttachmentPoint?->__toString() + 'removalAttachmentPoint' => $this->removalAttachmentPoint?->value ]); } @@ -108,12 +108,12 @@ public function updateToDatabase(Connection $databaseConnection, string $tableNa 'changed' => (int)$this->changed, 'moved' => (int)$this->moved, 'deleted' => (int)$this->deleted, - 'removalAttachmentPoint' => $this->removalAttachmentPoint?->__toString() + 'removalAttachmentPoint' => $this->removalAttachmentPoint?->value ], [ - 'contentStreamId' => (string)$this->contentStreamId, - 'nodeAggregateId' => (string)$this->nodeAggregateId, - 'originDimensionSpacePoint' => json_encode($this->originDimensionSpacePoint), + 'contentStreamId' => $this->contentStreamId->value, + 'nodeAggregateId' => $this->nodeAggregateId->value, + 'originDimensionSpacePoint' => $this->originDimensionSpacePoint->toJson(), 'originDimensionSpacePointHash' => $this->originDimensionSpacePoint->hash, ] ); diff --git a/Neos.Neos/Classes/PendingChangesProjection/ChangeFinder.php b/Neos.Neos/Classes/PendingChangesProjection/ChangeFinder.php index c91e4d45317..0bc48c0e98b 100644 --- a/Neos.Neos/Classes/PendingChangesProjection/ChangeFinder.php +++ b/Neos.Neos/Classes/PendingChangesProjection/ChangeFinder.php @@ -50,7 +50,7 @@ public function findByContentStreamId(ContentStreamId $contentStreamId): array WHERE contentStreamId = :contentStreamId ', [ - ':contentStreamId' => (string)$contentStreamId + ':contentStreamId' => $contentStreamId->value ] )->fetchAll(); $changes = []; @@ -69,7 +69,7 @@ public function countByContentStreamId(ContentStreamId $contentStreamId): int WHERE contentStreamId = :contentStreamId ', [ - ':contentStreamId' => (string)$contentStreamId + ':contentStreamId' => $contentStreamId->value ] )->rowCount(); } diff --git a/Neos.Neos/Classes/PendingChangesProjection/ChangeProjection.php b/Neos.Neos/Classes/PendingChangesProjection/ChangeProjection.php index 53e580d2971..ecdaeea6ca9 100644 --- a/Neos.Neos/Classes/PendingChangesProjection/ChangeProjection.php +++ b/Neos.Neos/Classes/PendingChangesProjection/ChangeProjection.php @@ -291,8 +291,8 @@ private function whenNodeAggregateWasRemoved(NodeAggregateWasRemoved $event): vo AND originDimensionSpacePointHash IN (:affectedDimensionSpacePointHashes) ', [ - 'contentStreamId' => (string)$event->contentStreamId, - 'nodeAggregateId' => (string)$event->nodeAggregateId, + 'contentStreamId' => $event->contentStreamId->value, + 'nodeAggregateId' => $event->nodeAggregateId->value, 'affectedDimensionSpacePointHashes' => $event->affectedCoveredDimensionSpacePoints ->getPointHashes() ], @@ -318,11 +318,11 @@ private function whenNodeAggregateWasRemoved(NodeAggregateWasRemoved $event): vo ) ', [ - 'contentStreamId' => (string)$event->contentStreamId, - 'nodeAggregateId' => (string)$event->nodeAggregateId, + 'contentStreamId' => $event->contentStreamId->value, + 'nodeAggregateId' => $event->nodeAggregateId->value, 'originDimensionSpacePoint' => json_encode($occupiedDimensionSpacePoint), 'originDimensionSpacePointHash' => $occupiedDimensionSpacePoint->hash, - 'removalAttachmentPoint' => $event->removalAttachmentPoint?->__toString() + 'removalAttachmentPoint' => $event->removalAttachmentPoint?->value, ] ); } @@ -345,8 +345,8 @@ private function whenDimensionSpacePointWasMoved(DimensionSpacePointWasMoved $ev [ 'originalDimensionSpacePointHash' => $event->source->hash, 'newDimensionSpacePointHash' => $event->target->hash, - 'newDimensionSpacePoint' => json_encode($event->target->jsonSerialize()), - 'contentStreamId' => (string)$event->contentStreamId + 'newDimensionSpacePoint' => $event->target->toJson(), + 'contentStreamId' => $event->contentStreamId->value ] ); }); @@ -468,8 +468,8 @@ private function getChange( AND n.nodeAggregateId = :nodeAggregateId AND n.originDimensionSpacePointHash = :originDimensionSpacePointHash', [ - 'contentStreamId' => $contentStreamId, - 'nodeAggregateId' => $nodeAggregateId, + 'contentStreamId' => $contentStreamId->value, + 'nodeAggregateId' => $nodeAggregateId->value, 'originDimensionSpacePointHash' => $originDimensionSpacePoint->hash ] )->fetch(); diff --git a/Neos.Neos/Classes/PendingChangesProjection/ChangeProjectionFactory.php b/Neos.Neos/Classes/PendingChangesProjection/ChangeProjectionFactory.php index 823b591be5e..a9c1f69abf4 100644 --- a/Neos.Neos/Classes/PendingChangesProjection/ChangeProjectionFactory.php +++ b/Neos.Neos/Classes/PendingChangesProjection/ChangeProjectionFactory.php @@ -53,7 +53,7 @@ public function build( $workspaceFinder, sprintf( 'cr_%s_p_neos_%s', - $projectionFactoryDependencies->contentRepositoryId, + $projectionFactoryDependencies->contentRepositoryId->value, $projectionShortName ), ); diff --git a/Neos.Neos/Classes/Presentation/Dimensions/VisualContentDimension.php b/Neos.Neos/Classes/Presentation/Dimensions/VisualContentDimension.php index cd440ce35fb..3e51d7ef6a5 100644 --- a/Neos.Neos/Classes/Presentation/Dimensions/VisualContentDimension.php +++ b/Neos.Neos/Classes/Presentation/Dimensions/VisualContentDimension.php @@ -78,8 +78,8 @@ public static function fromContentDimension( return new self( $offset, - (string)$contentDimension->id, - $contentDimension->getConfigurationValue('label') ?: (string)$contentDimension->id, + $contentDimension->id->value, + $contentDimension->getConfigurationValue('label') ?: $contentDimension->id->value, $nodes, $edges ); diff --git a/Neos.Neos/Classes/Presentation/Dimensions/VisualInterDimensionalVariationGraph.php b/Neos.Neos/Classes/Presentation/Dimensions/VisualInterDimensionalVariationGraph.php index cef90e65519..c8ce7a3095b 100644 --- a/Neos.Neos/Classes/Presentation/Dimensions/VisualInterDimensionalVariationGraph.php +++ b/Neos.Neos/Classes/Presentation/Dimensions/VisualInterDimensionalVariationGraph.php @@ -48,7 +48,7 @@ public static function forInterDimensionalVariationGraph( $height = 0; foreach ($contentDimensionSource->getContentDimensionsOrderedByPriority() as $contentDimension) { - $identifier = (string)$contentDimension->id; + $identifier = $contentDimension->id->value; $offsets[$identifier] = self::resolveOffsets($contentDimension); } @@ -61,7 +61,7 @@ public static function forInterDimensionalVariationGraph( $previousDepthFactor = 1; $previousWidthFactor = 1; foreach (array_reverse($dimensionSpacePoint->dimensionValues) as $dimensionIdentifier => $dimensionValue) { - $y += $dimensionValue->specializationDepth->depth * $previousDepthFactor; + $y += $dimensionValue->specializationDepth->value * $previousDepthFactor; $previousDepthFactor *= $offsets[$dimensionIdentifier]['_height']; $x += $offsets[$dimensionIdentifier][$dimensionValue->value]['x'] * $previousWidthFactor; diff --git a/Neos.Neos/Classes/Presentation/Dimensions/VisualIntraDimensionalVariationGraph.php b/Neos.Neos/Classes/Presentation/Dimensions/VisualIntraDimensionalVariationGraph.php index 5fcc079ade0..1217476e6df 100644 --- a/Neos.Neos/Classes/Presentation/Dimensions/VisualIntraDimensionalVariationGraph.php +++ b/Neos.Neos/Classes/Presentation/Dimensions/VisualIntraDimensionalVariationGraph.php @@ -40,7 +40,7 @@ public static function fromContentDimensionSource(ContentDimensionSourceInterfac $height = 0; foreach ($contentDimensionSource->getContentDimensionsOrderedByPriority() as $contentDimension) { - $dimensions[(string)$contentDimension->id] = VisualContentDimension::fromContentDimension( + $dimensions[$contentDimension->id->value] = VisualContentDimension::fromContentDimension( $contentDimension, $horizontalOffset, $counter, diff --git a/Neos.Neos/Classes/Presentation/Dimensions/VisualWeightedDimensionSpacePoint.php b/Neos.Neos/Classes/Presentation/Dimensions/VisualWeightedDimensionSpacePoint.php index 67622be59f1..fd326f3081f 100644 --- a/Neos.Neos/Classes/Presentation/Dimensions/VisualWeightedDimensionSpacePoint.php +++ b/Neos.Neos/Classes/Presentation/Dimensions/VisualWeightedDimensionSpacePoint.php @@ -14,6 +14,7 @@ namespace Neos\Neos\Presentation\Dimensions; +use Neos\ContentRepository\Core\Dimension\ContentDimensionValueSpecializationDepth; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; use Neos\ContentRepository\Core\DimensionSpace\WeightedDimensionSpacePoint; use Neos\Flow\Annotations as Flow; @@ -45,8 +46,9 @@ public static function fromDimensionSpacePoint( int &$height ): self { $depth = 0; - foreach ($dimensionSpacePoint->weight->weight as $weight) { - $depth += $weight->depth; + /** @var ContentDimensionValueSpecializationDepth $weight */ + foreach ($dimensionSpacePoint->weight->value as $weight) { + $depth += $weight->value; } $previousY = $y; $y = $depth * 110 + 42; diff --git a/Neos.Neos/Classes/Routing/Cache/RouteCacheFlusher.php b/Neos.Neos/Classes/Routing/Cache/RouteCacheFlusher.php index 01cc2c84452..be49d9cf6cf 100644 --- a/Neos.Neos/Classes/Routing/Cache/RouteCacheFlusher.php +++ b/Neos.Neos/Classes/Routing/Cache/RouteCacheFlusher.php @@ -46,7 +46,7 @@ class RouteCacheFlusher */ public function registerNodeChange(Node $node) { - $identifier = (string)$node->nodeAggregateId; + $identifier = $node->nodeAggregateId->value; if (in_array($identifier, $this->tagsToFlush)) { return; } @@ -72,7 +72,7 @@ public function registerBaseWorkspaceChange( Workspace $oldBaseWorkspace = null, Workspace $newBaseWorkspace = null ) { - $identifier = (string)$workspace->workspaceName; + $identifier = $workspace->workspaceName->value; if (!in_array($identifier, $this->tagsToFlush)) { $this->tagsToFlush[] = $identifier; } diff --git a/Neos.Neos/Classes/Service/ContentElementWrappingService.php b/Neos.Neos/Classes/Service/ContentElementWrappingService.php index 7620c03b311..70151b2284b 100644 --- a/Neos.Neos/Classes/Service/ContentElementWrappingService.php +++ b/Neos.Neos/Classes/Service/ContentElementWrappingService.php @@ -194,7 +194,7 @@ protected function addGenericEditingMetadata(array $attributes, Node $node): arr $nodeAddress = NodeAddressFactory::create($contentRepository)->createFromNode($node); $attributes['typeof'] = 'typo3:' . $node->nodeType->getName(); $attributes['about'] = $nodeAddress->serializeForUri(); - $attributes['data-node-_identifier'] = (string)$node->nodeAggregateId; + $attributes['data-node-_identifier'] = $node->nodeAggregateId->value; $attributes['data-node-__workspace-name'] = $nodeAddress->workspaceName; $attributes['data-node-__label'] = $node->getLabel(); @@ -372,7 +372,7 @@ protected function appendNonRenderedContentNodeMetadata(Node $documentNode): voi continue; } - if (isset($this->renderedNodes[(string)$node->nodeAggregateId]) === false) { + if (isset($this->renderedNodes[$node->nodeAggregateId->value]) === false) { $serializedNode = json_encode($this->nodeInfoHelper->renderNode($node)); $nodeContextPath = $nodeAddressFactory->createFromNode($node)->serializeForUri(); /** @codingStandardsIgnoreStart */ diff --git a/Neos.Neos/Classes/Service/Mapping/NodeReferenceConverter.php b/Neos.Neos/Classes/Service/Mapping/NodeReferenceConverter.php index 53220589d47..aa4625ce7de 100644 --- a/Neos.Neos/Classes/Service/Mapping/NodeReferenceConverter.php +++ b/Neos.Neos/Classes/Service/Mapping/NodeReferenceConverter.php @@ -68,10 +68,10 @@ public function convertFrom( if (is_array($source)) { $result = []; foreach ($source as $node) { - $result[] = (string)$node->nodeAggregateId; + $result[] = $node->nodeAggregateId->value; } } else { - $result = (string)$source->nodeAggregateId; + $result = $source->nodeAggregateId->value; } return $result; diff --git a/Neos.Neos/Classes/Service/PluginService.php b/Neos.Neos/Classes/Service/PluginService.php index 4a230aa26e3..d4533dfeb11 100644 --- a/Neos.Neos/Classes/Service/PluginService.php +++ b/Neos.Neos/Classes/Service/PluginService.php @@ -73,7 +73,7 @@ public function getPluginNodesWithViewDefinitions( $workspace = $contentRepository->getWorkspaceFinder()->findOneByName($workspaceName); if (is_null($workspace)) { - throw new \InvalidArgumentException('Could not find workspace "' . $workspaceName . '"'); + throw new \InvalidArgumentException('Could not find workspace "' . $workspaceName->value . '"'); } $siteNode = $this->siteNodeUtility->findCurrentSiteNode( @@ -224,7 +224,7 @@ public function getPluginViewNodeByMasterPlugin(Node $node, string $viewName): ? ])) as $pluginViewNode ) { if ( - $pluginViewNode->getProperty('plugin') === (string)$node->nodeAggregateId + $pluginViewNode->getProperty('plugin') === $node->nodeAggregateId->value && $pluginViewNode->getProperty('view') === $viewName ) { return $pluginViewNode; diff --git a/Neos.Neos/Classes/Service/View/NodeView.php b/Neos.Neos/Classes/Service/View/NodeView.php index 3b8148d67cc..25f78833468 100644 --- a/Neos.Neos/Classes/Service/View/NodeView.php +++ b/Neos.Neos/Classes/Service/View/NodeView.php @@ -120,8 +120,8 @@ public function assignNodes(Nodes $nodes): void $this->systemLogger->info(sprintf( 'You have a node that is no longer connected to a document node ancestor.' . ' Name: %s (Identifier: %s)', - $node->nodeName, - $node->nodeAggregateId + $node->nodeName?->value, + $node->nodeAggregateId->value ), LogEnvironment::fromMethodName(__METHOD__)); } } @@ -285,8 +285,8 @@ protected function collectChildNodeData( $expand === false && $untilNode !== null && strpos( - (string)$subgraph->retrieveNodePath($untilNode->nodeAggregateId), - (string)$subgraph->retrieveNodePath($childNode->nodeAggregateId), + $subgraph->retrieveNodePath($untilNode->nodeAggregateId)->value, + $subgraph->retrieveNodePath($childNode->nodeAggregateId)->value, ) === 0 && $childNode !== $untilNode ) { @@ -351,11 +351,11 @@ protected function collectChildNodeData( public function collectParentNodeData(Node $rootNode, Nodes $nodes): array { $subgraph = $this->contentRepositoryRegistry->subgraphForNode($rootNode); - $rootNodePath = (string)$subgraph->retrieveNodePath($rootNode->nodeAggregateId); + $rootNodePath = $subgraph->retrieveNodePath($rootNode->nodeAggregateId)->value; $nodeCollection = []; $addNode = function (Node $node, bool $matched) use ($subgraph, $rootNodePath, &$nodeCollection) { - $nodePath = (string)$subgraph->retrieveNodePath($node->nodeAggregateId); + $nodePath = $subgraph->retrieveNodePath($node->nodeAggregateId)->value; $path = str_replace('/', '.children.', substr($nodePath, strlen($rootNodePath) + 1)); if ($path !== '') { $nodeCollection = Arrays::setValueByPath($nodeCollection, $path . '.node', $node); diff --git a/Neos.Neos/Classes/Utility/NodeUriPathSegmentGenerator.php b/Neos.Neos/Classes/Utility/NodeUriPathSegmentGenerator.php index 16b57afd014..33a24f941f1 100644 --- a/Neos.Neos/Classes/Utility/NodeUriPathSegmentGenerator.php +++ b/Neos.Neos/Classes/Utility/NodeUriPathSegmentGenerator.php @@ -40,7 +40,7 @@ public function generateUriPathSegment(?Node $node = null, ?string $text = null) { $language = null; if ($node) { - $text = $text ?: $node->getLabel() ?: (string)$node->nodeName; + $text = $text ?: $node->getLabel() ?: ($node->nodeName?->value ?? ''); $languageDimensionValue = $node->originDimensionSpacePoint->coordinates['language'] ?? null; if (!is_null($languageDimensionValue)) { $locale = new Locale($languageDimensionValue); diff --git a/Neos.Neos/Classes/ViewHelpers/Link/NodeViewHelper.php b/Neos.Neos/Classes/ViewHelpers/Link/NodeViewHelper.php index 1c49ca761b9..d2885f59ed4 100644 --- a/Neos.Neos/Classes/ViewHelpers/Link/NodeViewHelper.php +++ b/Neos.Neos/Classes/ViewHelpers/Link/NodeViewHelper.php @@ -294,7 +294,7 @@ public function render(): string if ($resolvedNode === null) { $this->throwableStorage->logThrowable(new ViewHelperException(sprintf( 'Failed to resolve node "%s" on subgraph "%s"', - $nodeAddress->nodeAggregateId, + $nodeAddress->nodeAggregateId->value, json_encode($subgraph, JSON_PARTIAL_OUTPUT_ON_ERROR) ), 1601372444)); } @@ -311,7 +311,7 @@ public function render(): string } catch (NodeNotFoundException | InvalidShortcutException $e) { $this->throwableStorage->logThrowable(new ViewHelperException(sprintf( 'Failed to resolve shortcut node "%s" on subgraph "%s"', - $resolvedNode->nodeAggregateId, + $resolvedNode->nodeAggregateId->value, json_encode($subgraph, JSON_PARTIAL_OUTPUT_ON_ERROR) ), 1601370239, $e)); } @@ -391,7 +391,7 @@ private function resolveNodeAddressFromString( if ($siteNode === null) { throw new ViewHelperException(sprintf( 'Failed to determine site node for aggregate node "%s" and subgraph "%s"', - $documentNodeAddress->nodeAggregateId, + $documentNodeAddress->nodeAggregateId->value, json_encode($subgraph, JSON_PARTIAL_OUTPUT_ON_ERROR) ), 1601366598); } @@ -413,7 +413,7 @@ private function resolveNodeAddressFromString( throw new ViewHelperException(sprintf( 'Node on path "%s" could not be found for aggregate node "%s" and subgraph "%s"', $path, - $documentNodeAddress->nodeAggregateId, + $documentNodeAddress->nodeAggregateId->value, json_encode($subgraph, JSON_PARTIAL_OUTPUT_ON_ERROR) ), 1601311789); } diff --git a/Neos.Neos/Classes/ViewHelpers/Uri/NodeViewHelper.php b/Neos.Neos/Classes/ViewHelpers/Uri/NodeViewHelper.php index f587bcfa931..6cdcb6350c5 100644 --- a/Neos.Neos/Classes/ViewHelpers/Uri/NodeViewHelper.php +++ b/Neos.Neos/Classes/ViewHelpers/Uri/NodeViewHelper.php @@ -294,7 +294,7 @@ private function resolveNodeAddressFromString(string $path): ?NodeAddress if ($siteNode === null) { throw new ViewHelperException(sprintf( 'Failed to determine site node for aggregate node "%s" and subgraph "%s"', - $documentNodeAddress->nodeAggregateId, + $documentNodeAddress->nodeAggregateId->value, json_encode($subgraph, JSON_PARTIAL_OUTPUT_ON_ERROR) ), 1601366598); } @@ -316,7 +316,7 @@ private function resolveNodeAddressFromString(string $path): ?NodeAddress $this->throwableStorage->logThrowable(new ViewHelperException(sprintf( 'Node on path "%s" could not be found for aggregate node "%s" and subgraph "%s"', $path, - $documentNodeAddress->nodeAggregateId, + $documentNodeAddress->nodeAggregateId->value, json_encode($subgraph, JSON_PARTIAL_OUTPUT_ON_ERROR) ), 1601311789)); return null; diff --git a/Neos.Neos/Resources/Private/Templates/Module/Management/Workspaces/Edit.html b/Neos.Neos/Resources/Private/Templates/Module/Management/Workspaces/Edit.html index 07c136b06f4..7cb613248dd 100644 --- a/Neos.Neos/Resources/Private/Templates/Module/Management/Workspaces/Edit.html +++ b/Neos.Neos/Resources/Private/Templates/Module/Management/Workspaces/Edit.html @@ -11,14 +11,14 @@

{neos:backend.translate(id: 'workspaces.editWorkspace', source: 'Modules', p
- +
- +
diff --git a/Neos.Neos/Resources/Private/Templates/Module/Management/Workspaces/Index.html b/Neos.Neos/Resources/Private/Templates/Module/Management/Workspaces/Index.html index 4a2b3abad6d..c1aee362a04 100644 --- a/Neos.Neos/Resources/Private/Templates/Module/Management/Workspaces/Index.html +++ b/Neos.Neos/Resources/Private/Templates/Module/Management/Workspaces/Index.html @@ -41,11 +41,11 @@ - {workspace.workspaceTitle -> f:format.crop(maxCharacters: 25, append: '…')} + {workspace.workspaceTitle.value -> f:format.crop(maxCharacters: 25, append: '…')} - + - {workspace.baseWorkspaceName -> f:format.crop(maxCharacters: 25, append: '…')} + {workspace.baseWorkspaceName.value -> f:format.crop(maxCharacters: 25, append: '…')} - @@ -79,7 +79,7 @@ - + {neos:backend.translate(id: 'workspaces.review', source: 'Modules', package: 'Neos.Neos')} @@ -89,7 +89,7 @@
- + @@ -118,7 +118,7 @@
-
{neos:backend.translate(id: 'workspaces.dialog.confirmWorkspaceDeletion', source: 'Modules', package: 'Neos.Neos', arguments: {0: workspace.workspaceTitle})}
+
{neos:backend.translate(id: 'workspaces.dialog.confirmWorkspaceDeletion', source: 'Modules', package: 'Neos.Neos', arguments: {0: workspace.workspaceTitle.value})}

{neos:backend.translate(id: 'workspaces.dialog.thisWillDeleteTheWorkspace', source: 'Modules', package: 'Neos.Neos')}

@@ -127,7 +127,7 @@