1 | <?php |
||
28 | class MongoStorage implements StorageInterface |
||
29 | { |
||
30 | /** |
||
31 | * @var Manager |
||
32 | */ |
||
33 | private $conn; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | private $db; |
||
39 | |||
40 | /** |
||
41 | * @var array |
||
42 | */ |
||
43 | private $watched = array(); |
||
44 | |||
45 | /** |
||
46 | * @var bool |
||
47 | */ |
||
48 | private $transactional = false; |
||
49 | |||
50 | /** |
||
51 | * @var int |
||
52 | */ |
||
53 | private $transactionalLevel = 0; |
||
54 | |||
55 | /** |
||
56 | * Constructor. |
||
57 | * |
||
58 | * @param MongoConfig $config |
||
59 | */ |
||
60 | public function __construct(MongoConfig $config) |
||
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | */ |
||
69 | public function find($table, IdentifierInterface $id) |
||
90 | |||
91 | /** |
||
92 | * {@inheritdoc} |
||
93 | */ |
||
94 | public function append($table, DomainMessageInterface $message, $status, array $exception = null) |
||
117 | |||
118 | /** |
||
119 | * {@inheritdoc} |
||
120 | */ |
||
121 | public function drop($table) |
||
127 | |||
128 | /** |
||
129 | * @return boolean |
||
130 | */ |
||
131 | public function isTransactional() |
||
135 | |||
136 | /** |
||
137 | * @return int |
||
138 | */ |
||
139 | public function getTransactionalLevel() |
||
143 | |||
144 | /** |
||
145 | * Begin transaction |
||
146 | */ |
||
147 | public function beginTransaction() |
||
155 | |||
156 | /** |
||
157 | * Rollback transaction |
||
158 | */ |
||
159 | public function rollback() |
||
181 | |||
182 | /** |
||
183 | * Commit transaction. |
||
184 | */ |
||
185 | public function commit() |
||
197 | |||
198 | /** |
||
199 | * Serialize domain message. |
||
200 | * |
||
201 | * @param DomainMessageInterface $domain |
||
202 | * |
||
203 | * @return array |
||
204 | */ |
||
205 | private function serialize(DomainMessageInterface $domain) |
||
217 | |||
218 | /** |
||
219 | * Deserialize data to domain message. |
||
220 | * |
||
221 | * @param array $record |
||
222 | * |
||
223 | * @return DomainMessage |
||
224 | */ |
||
225 | private function deserialize(array $record) |
||
234 | |||
235 | /** |
||
236 | * Build an object from serialized data |
||
237 | * |
||
238 | * @param array $serializedObject |
||
239 | * |
||
240 | * @return DomainEventInterface |
||
241 | */ |
||
242 | private function build(array $serializedObject) |
||
262 | |||
263 | /** |
||
264 | * Assert array key |
||
265 | * |
||
266 | * @param array $serializeObject |
||
267 | * @param string $key |
||
268 | */ |
||
269 | private function assertKeyExists(array $serializeObject, $key) |
||
275 | } |
||
276 |