add getAll method to carrier repo
This commit is contained in:
parent
95feab744e
commit
059c111059
2 changed files with 15 additions and 0 deletions
|
|
@ -6,4 +6,9 @@ interface CarrierRepository
|
||||||
{
|
{
|
||||||
public function find(int $id): ?Carrier;
|
public function find(int $id): ?Carrier;
|
||||||
public function save(Carrier $carrier): Carrier;
|
public function save(Carrier $carrier): Carrier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Carrier[]
|
||||||
|
*/
|
||||||
|
public function getAll(): array;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,4 +36,14 @@ class FakeCarrierRepository implements CarrierRepository
|
||||||
{
|
{
|
||||||
return count($this->existingCarriers);
|
return count($this->existingCarriers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAll(): array
|
||||||
|
{
|
||||||
|
return array_map(function (Carrier $carrier) {
|
||||||
|
return new Carrier(
|
||||||
|
$carrier->getId(),
|
||||||
|
$carrier->getEmail()
|
||||||
|
);
|
||||||
|
}, $this->existingCarriers);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue