Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
38 | public function retrieve(AggregateRootId $id): ?Snapshot |
||
39 | { |
||
40 | $snapshot = $this->connection |
||
41 | ->table($this->table) |
||
42 | ->where('aggregate_root_id', $id->toString()) |
||
43 | ->first(); |
||
44 | |||
45 | if (is_null($snapshot)) { |
||
46 | return null; |
||
47 | } |
||
48 | |||
49 | return new Snapshot( |
||
50 | $id, |
||
51 | $snapshot->aggregate_root_version, |
||
52 | json_decode($snapshot->state) |
||
53 | ); |
||
56 |