Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
52 | public function save(AggregateRoot $root) |
||
53 | { |
||
54 | $aggregateId = (string) $root->getIdentity(); |
||
55 | $versionFile = $aggregateId . '-' . $root->getVersion(); |
||
56 | |||
57 | if (file_exists($this->dataPath . '/' . $versionFile)) { |
||
58 | throw new IdenticalSnapshot; |
||
59 | } |
||
60 | |||
61 | $stream = fopen($this->dataPath . '/' . $versionFile, 'w'); |
||
62 | |||
63 | fwrite($stream, serialize($root)); |
||
64 | fclose($stream); |
||
65 | } |
||
66 | } |
||
67 |