removed source and target schema. Not useful

This commit is contained in:
2024-10-08 22:52:14 +03:00
parent 800e2746e0
commit 19e8d648fc
12 changed files with 28 additions and 58 deletions
+8 -8
View File
@@ -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();