1 | <?php |
||
20 | final class DoctrineCargoRepository extends EntityRepository implements CargoRepositoryInterface |
||
21 | { |
||
22 | /** |
||
23 | * Finds a cargo using given id. |
||
24 | * |
||
25 | * @param TrackingId $trackingId Id |
||
26 | * @return Cargo if found, else null |
||
27 | */ |
||
28 | public function get(TrackingId $trackingId) |
||
32 | |||
33 | /** |
||
34 | * List all cargo. |
||
35 | * |
||
36 | * @return Cargo[] List of all Cargo |
||
37 | */ |
||
38 | public function getAll(): array |
||
42 | |||
43 | /** |
||
44 | * Saves given cargo. |
||
45 | * |
||
46 | * @param Cargo $cargo Cargo to save |
||
47 | */ |
||
48 | public function store(Cargo $cargo) |
||
49 | { |
||
50 | $this->getEntityManager()->persist($cargo); |
||
51 | $this->getEntityManager()->flush($cargo); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @return TrackingId A unique, generated tracking Id. |
||
56 | */ |
||
57 | public function getNextTrackingId(): TrackingId |
||
61 | } |
||
62 |