Skip to content

Commit

Permalink
TASK: Remove b/c layer Node::$contentStreamId
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Jul 26, 2024
1 parent ad6135e commit 32c2a26
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 186 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ public function findNodeAggregateById(
return $this->nodeFactory->mapNodeRowsToNodeAggregate(
$this->fetchRows($queryBuilder),
$this->workspaceName,
$this->contentStreamId,
VisibilityConstraints::withoutRestrictions()
);
}
Expand Down Expand Up @@ -247,7 +246,6 @@ public function findParentNodeAggregateByChildOriginDimensionSpacePoint(NodeAggr
return $this->nodeFactory->mapNodeRowsToNodeAggregate(
$this->fetchRows($queryBuilder),
$this->workspaceName,
$this->contentStreamId,
VisibilityConstraints::withoutRestrictions()
);
}
Expand Down Expand Up @@ -334,7 +332,6 @@ private function mapQueryBuilderToNodeAggregate(QueryBuilder $queryBuilder): ?No
return $this->nodeFactory->mapNodeRowsToNodeAggregate(
$this->fetchRows($queryBuilder),
$this->workspaceName,
$this->contentStreamId,
VisibilityConstraints::withoutRestrictions()
);
}
Expand All @@ -348,7 +345,6 @@ private function mapQueryBuilderToNodeAggregates(QueryBuilder $queryBuilder): No
return $this->nodeFactory->mapNodeRowsToNodeAggregates(
$this->fetchRows($queryBuilder),
$this->workspaceName,
$this->contentStreamId,
VisibilityConstraints::withoutRestrictions()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ public function findSubtree(NodeAggregateId $entryNodeAggregateId, FindSubtreeFi
$node = $this->nodeFactory->mapNodeRowToNode(
$nodeData,
$this->workspaceName,
$this->contentStreamId,
$this->dimensionSpacePoint,
$this->visibilityConstraints
);
Expand Down Expand Up @@ -333,7 +332,6 @@ public function findAncestorNodes(NodeAggregateId $entryNodeAggregateId, FindAnc
return $this->nodeFactory->mapNodeRowsToNodes(
$nodeRows,
$this->workspaceName,
$this->contentStreamId,
$this->dimensionSpacePoint,
$this->visibilityConstraints
);
Expand Down Expand Up @@ -387,7 +385,6 @@ public function findClosestNode(NodeAggregateId $entryNodeAggregateId, FindClose
return $this->nodeFactory->mapNodeRowsToNodes(
$nodeRows,
$this->workspaceName,
$this->contentStreamId,
$this->dimensionSpacePoint,
$this->visibilityConstraints
)->first();
Expand All @@ -407,7 +404,6 @@ public function findDescendantNodes(NodeAggregateId $entryNodeAggregateId, FindD
return $this->nodeFactory->mapNodeRowsToNodes(
$nodeRows,
$this->workspaceName,
$this->contentStreamId,
$this->dimensionSpacePoint,
$this->visibilityConstraints
);
Expand Down Expand Up @@ -679,7 +675,6 @@ private function fetchNode(QueryBuilder $queryBuilder): ?Node
return $this->nodeFactory->mapNodeRowToNode(
$nodeRow,
$this->workspaceName,
$this->contentStreamId,
$this->dimensionSpacePoint,
$this->visibilityConstraints
);
Expand All @@ -695,7 +690,6 @@ private function fetchNodes(QueryBuilder $queryBuilder): Nodes
return $this->nodeFactory->mapNodeRowsToNodes(
$nodeRows,
$this->workspaceName,
$this->contentStreamId,
$this->dimensionSpacePoint,
$this->visibilityConstraints
);
Expand All @@ -717,7 +711,12 @@ private function fetchReferences(QueryBuilder $queryBuilder): References
} catch (DBALException $e) {
throw new \RuntimeException(sprintf('Failed to fetch references: %s', $e->getMessage()), 1678364944, $e);
}
return $this->nodeFactory->mapReferenceRowsToReferences($referenceRows, $this->workspaceName, $this->contentStreamId, $this->dimensionSpacePoint, $this->visibilityConstraints);
return $this->nodeFactory->mapReferenceRowsToReferences(
$referenceRows,
$this->workspaceName,
$this->dimensionSpacePoint,
$this->visibilityConstraints
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public function __construct(
public function mapNodeRowToNode(
array $nodeRow,
WorkspaceName $workspaceName,
ContentStreamId $contentStreamId,
DimensionSpacePoint $dimensionSpacePoint,
VisibilityConstraints $visibilityConstraints
): Node {
Expand All @@ -85,8 +84,7 @@ public function mapNodeRowToNode(
isset($nodeRow['lastmodified']) ? self::parseDateTimeString($nodeRow['lastmodified']) : null,
isset($nodeRow['originallastmodified']) ? self::parseDateTimeString($nodeRow['originallastmodified']) : null,
),
$visibilityConstraints,
$contentStreamId
$visibilityConstraints
);
}

Expand All @@ -96,15 +94,13 @@ public function mapNodeRowToNode(
public function mapNodeRowsToNodes(
array $nodeRows,
WorkspaceName $workspaceName,
ContentStreamId $contentStreamId,
DimensionSpacePoint $dimensionSpacePoint,
VisibilityConstraints $visibilityConstraints
): Nodes {
return Nodes::fromArray(
array_map(fn (array $nodeRow) => $this->mapNodeRowToNode(
$nodeRow,
$workspaceName,
$contentStreamId,
$dimensionSpacePoint,
$visibilityConstraints
), $nodeRows)
Expand All @@ -125,7 +121,6 @@ public function createPropertyCollectionFromJsonString(string $jsonString): Prop
public function mapReferenceRowsToReferences(
array $nodeRows,
WorkspaceName $workspaceName,
ContentStreamId $contentStreamId,
DimensionSpacePoint $dimensionSpacePoint,
VisibilityConstraints $visibilityConstraints
): References {
Expand All @@ -134,7 +129,6 @@ public function mapReferenceRowsToReferences(
$node = $this->mapNodeRowToNode(
$nodeRow,
$workspaceName,
$contentStreamId,
$dimensionSpacePoint,
$visibilityConstraints
);
Expand All @@ -157,7 +151,6 @@ public function mapReferenceRowsToReferences(
public function mapNodeRowsToNodeAggregate(
array $nodeRows,
WorkspaceName $workspaceName,
ContentStreamId $contentStreamId,
VisibilityConstraints $visibilityConstraints
): ?NodeAggregate {
if (empty($nodeRows)) {
Expand All @@ -184,7 +177,6 @@ public function mapNodeRowsToNodeAggregate(
$nodesByOccupiedDimensionSpacePoint[$occupiedDimensionSpacePoint->hash] = $this->mapNodeRowToNode(
$nodeRow,
$workspaceName,
$contentStreamId,
$occupiedDimensionSpacePoint->toDimensionSpacePoint(),
$visibilityConstraints
);
Expand Down Expand Up @@ -240,7 +232,6 @@ public function mapNodeRowsToNodeAggregate(
public function mapNodeRowsToNodeAggregates(
array $nodeRows,
WorkspaceName $workspaceName,
ContentStreamId $contentStreamId,
VisibilityConstraints $visibilityConstraints
): NodeAggregates {
if (empty($nodeRows)) {
Expand Down Expand Up @@ -273,7 +264,6 @@ public function mapNodeRowsToNodeAggregates(
[$rawNodeAggregateId][$occupiedDimensionSpacePoint->hash] = $this->mapNodeRowToNode(
$nodeRow,
$workspaceName,
$contentStreamId,
$occupiedDimensionSpacePoint->toDimensionSpacePoint(),
$visibilityConstraints
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ public function __construct(
public function mapNodeRowToNode(
array $nodeRow,
VisibilityConstraints $visibilityConstraints,
?DimensionSpacePoint $dimensionSpacePoint = null,
?ContentStreamId $contentStreamId = null
?DimensionSpacePoint $dimensionSpacePoint = null
): Node {
return Node::create(
$this->contentRepositoryId,
Expand All @@ -92,7 +91,6 @@ public function mapNodeRowToNode(
isset($nodeRow['originallastmodified']) ? self::parseDateTimeString($nodeRow['originallastmodified']) : null,
),
$visibilityConstraints,
$contentStreamId ?: ContentStreamId::fromString($nodeRow['contentstreamid']),
);
}

Expand All @@ -101,16 +99,14 @@ public function mapNodeRowToNode(
*/
public function mapNodeRowsToNodes(
array $nodeRows,
VisibilityConstraints $visibilityConstraints,
ContentStreamId $contentStreamId = null
VisibilityConstraints $visibilityConstraints
): Nodes {
$nodes = [];
foreach ($nodeRows as $nodeRow) {
$nodes[] = $this->mapNodeRowToNode(
$nodeRow,
$visibilityConstraints,
null,
$contentStreamId
null
);
}

Expand All @@ -122,17 +118,15 @@ public function mapNodeRowsToNodes(
*/
public function mapReferenceRowsToReferences(
array $referenceRows,
VisibilityConstraints $visibilityConstraints,
ContentStreamId $contentStreamId = null
VisibilityConstraints $visibilityConstraints
): References {
$references = [];
foreach ($referenceRows as $referenceRow) {
$references[] = new Reference(
$this->mapNodeRowToNode(
$referenceRow,
$visibilityConstraints,
null,
$contentStreamId
null
),
ReferenceName::fromString($referenceRow['referencename']),
$referenceRow['referenceproperties']
Expand Down Expand Up @@ -205,8 +199,7 @@ public function mapNodeRowsToNodeAggregate(
$node = $this->mapNodeRowToNode(
$nodeRow,
$visibilityConstraints,
null,
$contentStreamId
null
);
$nodeAggregateId = $nodeAggregateId
?: NodeAggregateId::fromString($nodeRow['nodeaggregateid']);
Expand Down Expand Up @@ -291,8 +284,7 @@ public function mapNodeRowsToNodeAggregates(array $nodeRows, VisibilityConstrain
$node = $this->mapNodeRowToNode(
$nodeRow,
$visibilityConstraints,
null,
$contentStreamId
null
);
$nodeAggregateIds[$key] = NodeAggregateId::fromString(
$nodeRow['nodeaggregateid']
Expand Down

This file was deleted.

Loading

0 comments on commit 32c2a26

Please sign in to comment.