1 | <?php |
||
20 | class MongoSnapshot implements SnapshotInterface |
||
21 | { |
||
22 | use TransactionalTrait; |
||
23 | |||
24 | /** |
||
25 | * @var Manager |
||
26 | */ |
||
27 | private $conn; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | private $db; |
||
33 | |||
34 | /** |
||
35 | * @var int |
||
36 | */ |
||
37 | private $snapshotPeriodical; |
||
38 | |||
39 | /** |
||
40 | * Constructor. |
||
41 | * |
||
42 | * @param MongoConfig $config |
||
43 | * @param int $snapshotPeriodical |
||
44 | */ |
||
45 | public function __construct(MongoConfig $config, $snapshotPeriodical = SnapshotInterface::SNAPSHOT_PERIODICAL) |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | public function append(AggregateRootInterface $aggregate, $table) |
||
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | public function has(IdentifierInterface $id, $version, $table) |
||
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | public function find(IdentifierInterface $id, $class, $table) |
||
107 | |||
108 | /** |
||
109 | * {@inheritdoc} |
||
110 | */ |
||
111 | public function drop($table) |
||
117 | |||
118 | /** |
||
119 | * {@inheritdoc} |
||
120 | */ |
||
121 | public function getSnapshotPeriodical() |
||
125 | |||
126 | /** |
||
127 | * {@inheritdoc} |
||
128 | */ |
||
129 | public function setSnapshotPeriodical($snapshotPeriodical) |
||
133 | |||
134 | /** |
||
135 | * {@inheritdoc} |
||
136 | */ |
||
137 | protected function performCommit($table, array $records) |
||
141 | |||
142 | /** |
||
143 | * {@inheritdoc} |
||
144 | */ |
||
145 | protected function performRollback($table, array $records) |
||
156 | |||
157 | /** |
||
158 | * @param string $table |
||
159 | * @param int $version |
||
160 | * |
||
161 | * @return bool |
||
162 | */ |
||
163 | private function isNeedToSnapshot($table, $version) |
||
169 | |||
170 | /** |
||
171 | * @param string $table |
||
172 | * |
||
173 | * @return bool |
||
174 | */ |
||
175 | private function isEmpty($table) |
||
179 | |||
180 | /** |
||
181 | * Count collection. |
||
182 | * |
||
183 | * @param string $table |
||
184 | * @param array $query |
||
185 | * |
||
186 | * @return int |
||
187 | */ |
||
188 | private function count($table, array $query = array()) |
||
196 | |||
197 | /** |
||
198 | * Serialize aggregate root with metadata. |
||
199 | * |
||
200 | * @param AggregateRootInterface $aggregate |
||
201 | * |
||
202 | * @return array |
||
203 | */ |
||
204 | private function serialize(AggregateRootInterface $aggregate) |
||
213 | |||
214 | /** |
||
215 | * Deserialize from array to aggregate root. |
||
216 | * |
||
217 | * @param string $class |
||
218 | * @param array $serialized |
||
219 | * |
||
220 | * @return AggregateRootInterface |
||
221 | */ |
||
222 | private function deserialize($class, array $serialized) |
||
233 | |||
234 | /** |
||
235 | * @param string $table |
||
236 | * |
||
237 | * @return string |
||
238 | */ |
||
239 | private function getNamespace($table) |
||
243 | } |
||
244 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.