Skip to content

Commit 88cb1fd

Browse files
committed
Replace code using Value Objects
This changeset was created with a new rector ruleset (see neos/rector#11)
1 parent fa97f6e commit 88cb1fd

File tree

128 files changed

+478
-478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+478
-478
lines changed

Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/ProjectionIntegrityViolationDetectionTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,9 @@ private function findRelationAnchorPointByIds(
271271
AND h.contentstreamid = :contentStreamId
272272
AND h.dimensionspacepointhash = :dimensionSpacePointHash',
273273
[
274-
'contentStreamId' => (string)$contentStreamId,
274+
'contentStreamId' => $contentStreamId->value,
275275
'dimensionSpacePointHash' => $dimensionSpacePoint->hash,
276-
'nodeAggregateId' => (string)$nodeAggregateId
276+
'nodeAggregateId' => $nodeAggregateId->value
277277
]
278278
)->fetchAssociative();
279279

Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjection.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ private function whenRootNodeAggregateDimensionsWereUpdated(RootNodeAggregateDim
330330
', [
331331
'parentNodeAnchor' => (string)NodeRelationAnchorPoint::forRootEdge(),
332332
'childNodeAnchor' => (string)$rootNodeAnchorPoint,
333-
'contentStreamId' => (string)$event->contentStreamId
333+
'contentStreamId' => $event->contentStreamId->value
334334
]);
335335
// recreate hierarchy edges for the root node
336336
$this->connectHierarchy(
@@ -387,9 +387,9 @@ private function whenNodeAggregateNameWasChanged(NodeAggregateNameWasChanged $ev
387387
n.nodeaggregateid = :nodeAggregateId
388388
and h.contentstreamid = :contentStreamId
389389
', [
390-
'newName' => (string)$event->newNodeName,
391-
'nodeAggregateId' => (string)$event->nodeAggregateId,
392-
'contentStreamId' => (string)$event->contentStreamId
390+
'newName' => $event->newNodeName->value,
391+
'nodeAggregateId' => $event->nodeAggregateId->value,
392+
'contentStreamId' => $event->contentStreamId->value
393393
]);
394394
});
395395
}
@@ -418,18 +418,18 @@ private function connectRestrictionRelationsFromParentNodeToNewlyCreatedNode(
418418
r.contentstreamid,
419419
r.dimensionspacepointhash,
420420
r.originnodeaggregateid,
421-
"' . $newlyCreatedNodeAggregateId . '" as affectednodeaggregateid
421+
"' . $newlyCreatedNodeAggregateId->value . '" as affectednodeaggregateid
422422
FROM
423423
' . $this->tableNamePrefix . '_restrictionrelation r
424424
WHERE
425425
r.contentstreamid = :sourceContentStreamId
426426
and r.dimensionspacepointhash IN (:visibleDimensionSpacePoints)
427427
and r.affectednodeaggregateid = :parentNodeAggregateId
428428
', [
429-
'sourceContentStreamId' => (string)$contentStreamId,
429+
'sourceContentStreamId' => $contentStreamId->value,
430430
'visibleDimensionSpacePoints' => $dimensionSpacePointsInWhichNewlyCreatedNodeAggregateIsVisible
431431
->getPointHashes(),
432-
'parentNodeAggregateId' => (string)$parentNodeAggregateId
432+
'parentNodeAggregateId' => $parentNodeAggregateId->value
433433
], [
434434
'visibleDimensionSpacePoints' => Connection::PARAM_STR_ARRAY
435435
]);
@@ -655,12 +655,12 @@ public function whenContentStreamWasForked(ContentStreamWasForked $event): void
655655
h.position,
656656
h.dimensionspacepoint,
657657
h.dimensionspacepointhash,
658-
"' . $event->newContentStreamId . '" AS contentstreamid
658+
"' . $event->newContentStreamId->value . '" AS contentstreamid
659659
FROM
660660
' . $this->tableNamePrefix . '_hierarchyrelation h
661661
WHERE h.contentstreamid = :sourceContentStreamId
662662
', [
663-
'sourceContentStreamId' => (string)$event->sourceContentStreamId
663+
'sourceContentStreamId' => $event->sourceContentStreamId->value
664664
]);
665665

666666
//
@@ -674,15 +674,15 @@ public function whenContentStreamWasForked(ContentStreamWasForked $event): void
674674
affectednodeaggregateid
675675
)
676676
SELECT
677-
"' . $event->newContentStreamId . '" AS contentstreamid,
677+
"' . $event->newContentStreamId->value . '" AS contentstreamid,
678678
r.dimensionspacepointhash,
679679
r.originnodeaggregateid,
680680
r.affectednodeaggregateid
681681
FROM
682682
' . $this->tableNamePrefix . '_restrictionrelation r
683683
WHERE r.contentstreamid = :sourceContentStreamId
684684
', [
685-
'sourceContentStreamId' => (string)$event->sourceContentStreamId
685+
'sourceContentStreamId' => $event->sourceContentStreamId->value
686686
]);
687687

688688
// NOTE: as reference edges are attached to Relation Anchor Points (and they are lazily copy-on-written),
@@ -700,7 +700,7 @@ public function whenContentStreamWasRemoved(ContentStreamWasRemoved $event): voi
700700
WHERE
701701
contentstreamid = :contentStreamId
702702
', [
703-
'contentStreamId' => (string)$event->contentStreamId
703+
'contentStreamId' => $event->contentStreamId->value
704704
]);
705705

706706
// Drop non-referenced nodes (which do not have a hierarchy relation anymore)
@@ -731,7 +731,7 @@ public function whenContentStreamWasRemoved(ContentStreamWasRemoved $event): voi
731731
WHERE
732732
contentstreamid = :contentStreamId
733733
', [
734-
'contentStreamId' => (string)$event->contentStreamId
734+
'contentStreamId' => $event->contentStreamId->value
735735
]);
736736
});
737737
}
@@ -766,8 +766,8 @@ public function whenNodeReferencesWereSet(NodeReferencesWereSet $event): void
766766
throw new \InvalidArgumentException(
767767
'Could not apply event of type "' . get_class($event)
768768
. '" since no anchor point could be resolved for node '
769-
. $event->getNodeAggregateId() . ' in content stream '
770-
. $event->getContentStreamId(),
769+
. $event->getNodeAggregateId()->value . ' in content stream '
770+
. $event->getContentStreamId()->value,
771771
1658580583
772772
);
773773
}
@@ -867,7 +867,7 @@ private function cascadeRestrictionRelations(
867867
-- create new restriction relations...
868868
-- --------------------------------
869869
SELECT
870-
"' . (string)$contentStreamId . '" as contentstreamid,
870+
"' . $contentStreamId->value . '" as contentstreamid,
871871
tree.dimensionspacepointhash,
872872
originnodeaggregateid,
873873
tree.nodeaggregateid as affectednodeaggregateid
@@ -883,9 +883,9 @@ private function cascadeRestrictionRelations(
883883
) AS joinedrestrictingancestors
884884
',
885885
[
886-
'contentStreamId' => (string)$contentStreamId,
887-
'parentNodeAggregateId' => (string)$parentNodeAggregateId,
888-
'entryNodeAggregateId' => (string)$entryNodeAggregateId,
886+
'contentStreamId' => $contentStreamId->value,
887+
'parentNodeAggregateId' => $parentNodeAggregateId->value,
888+
'entryNodeAggregateId' => $entryNodeAggregateId->value,
889889
'dimensionSpacePointHashes' => $affectedDimensionSpacePoints->getPointHashes(),
890890
'affectedDimensionSpacePointHashes' => $affectedDimensionSpacePoints->getPointHashes()
891891
],
@@ -1069,7 +1069,7 @@ protected function updateNodeRecordWithCopyOnWrite(
10691069
[
10701070
'newNodeAnchor' => (string)$copiedNode->relationAnchorPoint,
10711071
'originalNodeAnchor' => (string)$anchorPoint,
1072-
'contentStreamId' => (string)$contentStreamIdWhereWriteOccurs
1072+
'contentStreamId' => $contentStreamIdWhereWriteOccurs->value
10731073
]
10741074
);
10751075

@@ -1139,7 +1139,7 @@ public function whenDimensionSpacePointWasMoved(DimensionSpacePointWasMoved $eve
11391139
',
11401140
[
11411141
'dimensionSpacePointHash' => $event->source->hash,
1142-
'contentStreamId' => (string)$event->contentStreamId
1142+
'contentStreamId' => $event->contentStreamId->value
11431143
]
11441144
);
11451145
while ($res = $rel->fetchAssociative()) {
@@ -1169,7 +1169,7 @@ function (NodeRecord $nodeRecord) use ($event) {
11691169
'originalDimensionSpacePointHash' => $event->source->hash,
11701170
'newDimensionSpacePointHash' => $event->target->hash,
11711171
'newDimensionSpacePoint' => json_encode($event->target->jsonSerialize()),
1172-
'contentStreamId' => (string)$event->contentStreamId
1172+
'contentStreamId' => $event->contentStreamId->value
11731173
]
11741174
);
11751175

@@ -1186,7 +1186,7 @@ function (NodeRecord $nodeRecord) use ($event) {
11861186
[
11871187
'originalDimensionSpacePointHash' => $event->source->hash,
11881188
'newDimensionSpacePointHash' => $event->target->hash,
1189-
'contentStreamId' => (string)$event->contentStreamId
1189+
'contentStreamId' => $event->contentStreamId->value
11901190
]
11911191
);
11921192
});
@@ -1246,7 +1246,7 @@ public function whenDimensionShineThroughWasAdded(DimensionShineThroughWasAdded
12461246
AND r.dimensionspacepointhash = :sourceDimensionSpacePointHash
12471247
12481248
', [
1249-
'contentStreamId' => (string)$event->contentStreamId,
1249+
'contentStreamId' => $event->contentStreamId->value,
12501250
'sourceDimensionSpacePointHash' => $event->source->hash,
12511251
'targetDimensionSpacePointHash' => $event->target->hash
12521252
]);

Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/Feature/NodeDisabling.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ private function whenNodeAggregateWasDisabled(NodeAggregateWasDisabled $event):
6868
)
6969
7070
select
71-
"' . $event->contentStreamId . '" as contentstreamid,
71+
"' . $event->contentStreamId->value . '" as contentstreamid,
7272
dimensionspacepointhash,
73-
"' . $event->nodeAggregateId . '" as originnodeaggregateid,
73+
"' . $event->nodeAggregateId->value . '" as originnodeaggregateid,
7474
nodeaggregateid as affectednodeaggregateid
7575
from tree
7676
',
7777
[
78-
'entryNodeAggregateId' => (string)$event->nodeAggregateId,
79-
'contentStreamId' => (string)$event->contentStreamId,
78+
'entryNodeAggregateId' => $event->nodeAggregateId->value,
79+
'contentStreamId' => $event->contentStreamId->value,
8080
'dimensionSpacePointHashes' => $event->affectedDimensionSpacePoints->getPointHashes()
8181
],
8282
[

Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/Feature/RestrictionRelations.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ private function removeOutgoingRestrictionRelationsOfNodeAggregateInDimensionSpa
4040
AND r.originnodeaggregateid = :originNodeAggregateId
4141
AND r.dimensionspacepointhash in (:dimensionSpacePointHashes)',
4242
[
43-
'contentStreamId' => (string)$contentStreamId,
44-
'originNodeAggregateId' => (string)$originNodeAggregateId,
43+
'contentStreamId' => $contentStreamId->value,
44+
'originNodeAggregateId' => $originNodeAggregateId->value,
4545
'dimensionSpacePointHashes' => $affectedDimensionSpacePoints->getPointHashes()
4646
],
4747
[
@@ -111,8 +111,8 @@ private function removeAllRestrictionRelationsUnderneathNodeAggregate(
111111
and r.affectednodeaggregateid = tree.nodeaggregateid
112112
',
113113
[
114-
'entryNodeAggregateId' => (string)$nodeAggregateId,
115-
'contentStreamId' => (string)$contentStreamId,
114+
'entryNodeAggregateId' => $nodeAggregateId->value,
115+
'contentStreamId' => $contentStreamId->value,
116116
]
117117
);
118118
}
@@ -143,7 +143,7 @@ private function removeAllRestrictionRelationsInSubtreeImposedByAncestors(
143143
AND r.affectednodeaggregateid IN (:descendantNodeAggregateIds)
144144
AND r.dimensionspacepointhash IN (:affectedDimensionSpacePointHashes)',
145145
[
146-
'contentStreamId' => (string)$contentStreamId,
146+
'contentStreamId' => $contentStreamId->value,
147147
'descendantNodeAggregateIds' => array_keys($descendantNodeAggregateIds),
148148
'affectedDimensionSpacePointHashes' => $affectedDimensionSpacePoints->getPointHashes()
149149
],

Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/NodeRecord.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ public function addToDatabase(Connection $databaseConnection, string $tableNameP
5050
{
5151
$databaseConnection->insert($tableNamePrefix . '_node', [
5252
'relationanchorpoint' => (string)$this->relationAnchorPoint,
53-
'nodeaggregateid' => (string)$this->nodeAggregateId,
53+
'nodeaggregateid' => $this->nodeAggregateId->value,
5454
'origindimensionspacepoint' => json_encode($this->originDimensionSpacePoint),
5555
'origindimensionspacepointhash' => $this->originDimensionSpacePointHash,
5656
'properties' => json_encode($this->properties),
57-
'nodetypename' => (string)$this->nodeTypeName,
57+
'nodetypename' => $this->nodeTypeName->value,
5858
'classification' => $this->classification->value
5959
]);
6060
}
@@ -68,11 +68,11 @@ public function updateToDatabase(Connection $databaseConnection, string $tableNa
6868
$databaseConnection->update(
6969
$tableNamePrefix . '_node',
7070
[
71-
'nodeaggregateid' => (string)$this->nodeAggregateId,
71+
'nodeaggregateid' => $this->nodeAggregateId->value,
7272
'origindimensionspacepoint' => json_encode($this->originDimensionSpacePoint),
7373
'origindimensionspacepointhash' => $this->originDimensionSpacePointHash,
7474
'properties' => json_encode($this->properties),
75-
'nodetypename' => (string)$this->nodeTypeName,
75+
'nodetypename' => $this->nodeTypeName->value,
7676
'classification' => $this->classification->value
7777
],
7878
[

0 commit comments

Comments
 (0)