Skip to content

Commit

Permalink
Replace code using Value Objects
Browse files Browse the repository at this point in the history
This changeset was created with a new rector ruleset (see neos/rector#11)
  • Loading branch information
bwaidelich committed Apr 1, 2023
1 parent fa97f6e commit 88cb1fd
Show file tree
Hide file tree
Showing 128 changed files with 478 additions and 478 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ private function whenRootNodeAggregateDimensionsWereUpdated(RootNodeAggregateDim
', [
'parentNodeAnchor' => (string)NodeRelationAnchorPoint::forRootEdge(),
'childNodeAnchor' => (string)$rootNodeAnchorPoint,
'contentStreamId' => (string)$event->contentStreamId
'contentStreamId' => $event->contentStreamId->value
]);
// recreate hierarchy edges for the root node
$this->connectHierarchy(
Expand Down Expand Up @@ -387,9 +387,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
]);
});
}
Expand Down Expand Up @@ -418,18 +418,18 @@ private function connectRestrictionRelationsFromParentNodeToNewlyCreatedNode(
r.contentstreamid,
r.dimensionspacepointhash,
r.originnodeaggregateid,
"' . $newlyCreatedNodeAggregateId . '" as affectednodeaggregateid
"' . $newlyCreatedNodeAggregateId->value . '" as affectednodeaggregateid
FROM
' . $this->tableNamePrefix . '_restrictionrelation r
WHERE
r.contentstreamid = :sourceContentStreamId
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
]);
Expand Down Expand Up @@ -655,12 +655,12 @@ public 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
]);

//
Expand All @@ -674,15 +674,15 @@ public function whenContentStreamWasForked(ContentStreamWasForked $event): void
affectednodeaggregateid
)
SELECT
"' . $event->newContentStreamId . '" AS contentstreamid,
"' . $event->newContentStreamId->value . '" AS contentstreamid,
r.dimensionspacepointhash,
r.originnodeaggregateid,
r.affectednodeaggregateid
FROM
' . $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),
Expand All @@ -700,7 +700,7 @@ public function whenContentStreamWasRemoved(ContentStreamWasRemoved $event): voi
WHERE
contentstreamid = :contentStreamId
', [
'contentStreamId' => (string)$event->contentStreamId
'contentStreamId' => $event->contentStreamId->value
]);

// Drop non-referenced nodes (which do not have a hierarchy relation anymore)
Expand Down Expand Up @@ -731,7 +731,7 @@ public function whenContentStreamWasRemoved(ContentStreamWasRemoved $event): voi
WHERE
contentstreamid = :contentStreamId
', [
'contentStreamId' => (string)$event->contentStreamId
'contentStreamId' => $event->contentStreamId->value
]);
});
}
Expand Down Expand Up @@ -766,8 +766,8 @@ public function whenNodeReferencesWereSet(NodeReferencesWereSet $event): void
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
);
}
Expand Down Expand Up @@ -867,7 +867,7 @@ private function cascadeRestrictionRelations(
-- create new restriction relations...
-- --------------------------------
SELECT
"' . (string)$contentStreamId . '" as contentstreamid,
"' . $contentStreamId->value . '" as contentstreamid,
tree.dimensionspacepointhash,
originnodeaggregateid,
tree.nodeaggregateid as affectednodeaggregateid
Expand All @@ -883,9 +883,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()
],
Expand Down Expand Up @@ -1069,7 +1069,7 @@ protected function updateNodeRecordWithCopyOnWrite(
[
'newNodeAnchor' => (string)$copiedNode->relationAnchorPoint,
'originalNodeAnchor' => (string)$anchorPoint,
'contentStreamId' => (string)$contentStreamIdWhereWriteOccurs
'contentStreamId' => $contentStreamIdWhereWriteOccurs->value
]
);

Expand Down Expand Up @@ -1139,7 +1139,7 @@ public function whenDimensionSpacePointWasMoved(DimensionSpacePointWasMoved $eve
',
[
'dimensionSpacePointHash' => $event->source->hash,
'contentStreamId' => (string)$event->contentStreamId
'contentStreamId' => $event->contentStreamId->value
]
);
while ($res = $rel->fetchAssociative()) {
Expand Down Expand Up @@ -1169,7 +1169,7 @@ function (NodeRecord $nodeRecord) use ($event) {
'originalDimensionSpacePointHash' => $event->source->hash,
'newDimensionSpacePointHash' => $event->target->hash,
'newDimensionSpacePoint' => json_encode($event->target->jsonSerialize()),
'contentStreamId' => (string)$event->contentStreamId
'contentStreamId' => $event->contentStreamId->value
]
);

Expand All @@ -1186,7 +1186,7 @@ function (NodeRecord $nodeRecord) use ($event) {
[
'originalDimensionSpacePointHash' => $event->source->hash,
'newDimensionSpacePointHash' => $event->target->hash,
'contentStreamId' => (string)$event->contentStreamId
'contentStreamId' => $event->contentStreamId->value
]
);
});
Expand Down Expand Up @@ -1246,7 +1246,7 @@ public function whenDimensionShineThroughWasAdded(DimensionShineThroughWasAdded
AND r.dimensionspacepointhash = :sourceDimensionSpacePointHash
', [
'contentStreamId' => (string)$event->contentStreamId,
'contentStreamId' => $event->contentStreamId->value,
'sourceDimensionSpacePointHash' => $event->source->hash,
'targetDimensionSpacePointHash' => $event->target->hash
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,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()
],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
],
[
Expand Down Expand Up @@ -111,8 +111,8 @@ private function removeAllRestrictionRelationsUnderneathNodeAggregate(
and r.affectednodeaggregateid = tree.nodeaggregateid
',
[
'entryNodeAggregateId' => (string)$nodeAggregateId,
'contentStreamId' => (string)$contentStreamId,
'entryNodeAggregateId' => $nodeAggregateId->value,
'contentStreamId' => $contentStreamId->value,
]
);
}
Expand Down Expand Up @@ -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()
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ public function addToDatabase(Connection $databaseConnection, string $tableNameP
{
$databaseConnection->insert($tableNamePrefix . '_node', [
'relationanchorpoint' => (string)$this->relationAnchorPoint,
'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
]);
}
Expand All @@ -68,11 +68,11 @@ 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
],
[
Expand Down
Loading

0 comments on commit 88cb1fd

Please sign in to comment.