Skip to content

Commit b530a2f

Browse files
author
snk-spo
authored
[FEATURE] Make Node->depth actually initialized and usable
Actually initializes already present Node->depth property. Fixes: #4216
1 parent d79c92c commit b530a2f

File tree

1 file changed

+10
-1
lines changed
  • Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy

1 file changed

+10
-1
lines changed

Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/Node.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
class Node extends AbstractOptionFacetItem
2424
{
25-
protected int $depth;
25+
protected int $depth = 0;
2626

2727
public function __construct(
2828
HierarchyFacet $facet,
@@ -41,6 +41,10 @@ public function __construct(
4141
$documentCount,
4242
$selected,
4343
);
44+
45+
if ($parentNode) {
46+
$this->depth = $parentNode->getDepth() + 1;
47+
}
4448
}
4549

4650
public function getKey(): string
@@ -68,6 +72,11 @@ public function getHasParentNode(): bool
6872
return $this->parentNode !== null;
6973
}
7074

75+
public function getDepth(): int
76+
{
77+
return $this->depth;
78+
}
79+
7180
public function getHasChildNodeSelected(): bool
7281
{
7382
/** @var Node $childNode */

0 commit comments

Comments
 (0)