Skip to content

Commit

Permalink
Merge pull request #68 from gradinarufelix/bugfix-empty-dimensions
Browse files Browse the repository at this point in the history
BUGFIX: Do not fail on empty dimension values
  • Loading branch information
nezaniel authored Sep 20, 2024
2 parents a1f2e50 + 3a788ba commit 940f920
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ public static function fromArray(array $array): self
is_string($array['workspaceName'])
or throw new \InvalidArgumentException('Workspace name must be a string');

isset($array['dimensionValues'])
or throw new \InvalidArgumentException('Dimension values must be set');
is_array($array['dimensionValues'])
or throw new \InvalidArgumentException('Dimension values must be an array');

isset($array['treeNodeId'])
or throw new \InvalidArgumentException('Tree node id must be set');
is_string($array['treeNodeId'])
Expand All @@ -63,7 +58,7 @@ public static function fromArray(array $array): self

return new self(
workspaceName: $array['workspaceName'],
dimensionValues: $array['dimensionValues'],
dimensionValues: $array['dimensionValues'] ?? [],
treeNodeId: NodeAggregateIdentifier::fromString($array['treeNodeId']),
nodeTypeFilter: $array['nodeTypeFilter'] ?? '',
linkableNodeTypes: NodeTypeNames::fromArray($array['linkableNodeTypes'] ?? []),
Expand Down
7 changes: 1 addition & 6 deletions Classes/Application/GetNodeSummary/GetNodeSummaryQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,14 @@ public static function fromArray(array $array): self
is_string($array['workspaceName'])
or throw new \InvalidArgumentException('Workspace name must be a string');

isset($array['dimensionValues'])
or throw new \InvalidArgumentException('Dimension values must be set');
is_array($array['dimensionValues'])
or throw new \InvalidArgumentException('Dimension values must be an array');

isset($array['nodeId'])
or throw new \InvalidArgumentException('Node id must be set');
is_string($array['nodeId'])
or throw new \InvalidArgumentException('Node id must be a string');

return new self(
workspaceName: $array['workspaceName'],
dimensionValues: $array['dimensionValues'],
dimensionValues: $array['dimensionValues'] ?? [],
nodeId: NodeAggregateIdentifier::fromString($array['nodeId']),
);
}
Expand Down
7 changes: 1 addition & 6 deletions Classes/Application/GetTree/GetTreeQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ public static function fromArray(array $array): self
is_string($array['workspaceName'])
or throw new \InvalidArgumentException('Workspace name must be a string');

isset($array['dimensionValues'])
or throw new \InvalidArgumentException('Dimension values must be set');
is_array($array['dimensionValues'])
or throw new \InvalidArgumentException('Dimension values must be an array');

isset($array['startingPoint'])
or throw new \InvalidArgumentException('Starting point must be set');
is_string($array['startingPoint'])
Expand Down Expand Up @@ -85,7 +80,7 @@ public static function fromArray(array $array): self

return new self(
workspaceName: $array['workspaceName'],
dimensionValues: $array['dimensionValues'],
dimensionValues: $array['dimensionValues'] ?? [],
startingPoint: NodePath::fromString($array['startingPoint']),
loadingDepth: $array['loadingDepth'],
baseNodeTypeFilter: $array['baseNodeTypeFilter'] ?? '',
Expand Down

0 comments on commit 940f920

Please sign in to comment.