add find method to plan
This commit is contained in:
parent
412a74e390
commit
449df516ae
2 changed files with 11 additions and 0 deletions
|
|
@ -5,4 +5,5 @@ namespace App\Plan;
|
|||
interface PlanRepository
|
||||
{
|
||||
public function create(CreatePlanDto $dto): Plan;
|
||||
public function find(int $id): ?Plan;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,4 +27,14 @@ class FakePlanRepository implements PlanRepository
|
|||
{
|
||||
return count($this->existingPlans);
|
||||
}
|
||||
|
||||
public function find(int $id): ?Plan
|
||||
{
|
||||
return array_find(
|
||||
$this->existingPlans,
|
||||
function (Plan $plan) use ($id) {
|
||||
return $plan->getId() === $id;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue