add find by text id method to node repo w/ impl

This commit is contained in:
Yisroel Baum 2026-02-21 22:43:55 +02:00
parent 1c28f46872
commit 4f83ae7926
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
2 changed files with 15 additions and 0 deletions

View file

@ -9,4 +9,9 @@ interface NodeRepository
public function create(CreateNodeDto $dto): Node; public function create(CreateNodeDto $dto): Node;
public function find(int $id): ?Node; public function find(int $id): ?Node;
/**
* @return Node[]
*/
public function findByTextId(int $id): array;
} }

View file

@ -48,4 +48,14 @@ class FakeNodeRepository implements NodeRepository
parentNode: $node->getParentNode(), parentNode: $node->getParentNode(),
); );
} }
public function findByTextId(int $id): array
{
return array_filter(
$this->existingNodes,
function (Node $node) use ($id) {
return $node->getId() === $id;
}
);
}
} }