add find by text id method to node repo w/ impl
This commit is contained in:
parent
1c28f46872
commit
4f83ae7926
2 changed files with 15 additions and 0 deletions
|
|
@ -9,4 +9,9 @@ interface NodeRepository
|
|||
public function create(CreateNodeDto $dto): Node;
|
||||
|
||||
public function find(int $id): ?Node;
|
||||
|
||||
/**
|
||||
* @return Node[]
|
||||
*/
|
||||
public function findByTextId(int $id): array;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,4 +48,14 @@ class FakeNodeRepository implements NodeRepository
|
|||
parentNode: $node->getParentNode(),
|
||||
);
|
||||
}
|
||||
|
||||
public function findByTextId(int $id): array
|
||||
{
|
||||
return array_filter(
|
||||
$this->existingNodes,
|
||||
function (Node $node) use ($id) {
|
||||
return $node->getId() === $id;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue