removed source and target schema. Not useful
This commit is contained in:
+8
-8
@@ -14,11 +14,11 @@ final class Graph
|
||||
* @param Collection<Edge> $edges
|
||||
* */
|
||||
public function __construct(
|
||||
public Collection $records,
|
||||
public Collection $edges,
|
||||
public Collection $parentEdges,
|
||||
public Collection $records,
|
||||
public Collection $edges,
|
||||
public Collection $parentEdges,
|
||||
public QueryOptions $queryOptions,
|
||||
public ?int $total = null,
|
||||
public ?int $total = null,
|
||||
)
|
||||
{
|
||||
}
|
||||
@@ -47,12 +47,12 @@ final class Graph
|
||||
|
||||
public function findChildren(QueryRecord $record, int $depth = 1): QueryRecord
|
||||
{
|
||||
if($this->queryOptions->childrenDepth < $depth){
|
||||
if ($this->queryOptions->childrenDepth < $depth) {
|
||||
return $record;
|
||||
}
|
||||
$recordEdges = $this->edges
|
||||
->filter(fn(Edge $ed) => $ed->source === $record->id )
|
||||
->unique(fn(Edge $ed) => $ed->targetSchema . $ed->field . $ed->target . $ed->source)
|
||||
->filter(fn(Edge $ed) => $ed->source === $record->id)
|
||||
->unique(fn(Edge $ed) => $ed->field . $ed->target . $ed->source)
|
||||
->sort(fn($a, $b) => $a->rank <=> $b->rank)->values();
|
||||
$groupRecordEdges = [];
|
||||
foreach ($recordEdges as $element) {
|
||||
@@ -78,7 +78,7 @@ final class Graph
|
||||
|
||||
public function findParents(QueryRecord $record, int $depth = 1): QueryRecord
|
||||
{
|
||||
if($this->queryOptions->parentsDepth < $depth){
|
||||
if ($this->queryOptions->parentsDepth < $depth) {
|
||||
return $record;
|
||||
}
|
||||
$recordEdges = $this->parentEdges->filter(fn(Edge $ed) => $ed->target === $record->id)->where("depth", $depth)->values()->sort(fn($a, $b) => $a->rank <=> $b->rank)->values();
|
||||
|
||||
Reference in New Issue
Block a user