Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 15 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
LogQuery | |
0.00% |
0 / 15 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
loadMetadataBatch | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
loadPostsBatch | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
12 |
1 | <?php |
2 | |
3 | namespace Flow\Log; |
4 | |
5 | use Flow\Formatter\AbstractQuery; |
6 | use Flow\Model\PostRevision; |
7 | use Flow\Model\UUID; |
8 | |
9 | class LogQuery extends AbstractQuery { |
10 | /** |
11 | * @param UUID[] $uuids |
12 | * @suppress PhanParamSignatureMismatch It doesn't match though |
13 | */ |
14 | public function loadMetadataBatch( $uuids ) { |
15 | $posts = $this->loadPostsBatch( $uuids ); |
16 | parent::loadMetadataBatch( $posts ); |
17 | } |
18 | |
19 | /** |
20 | * @param UUID[] $uuids |
21 | * @return PostRevision[] |
22 | */ |
23 | protected function loadPostsBatch( array $uuids ) { |
24 | $queries = []; |
25 | foreach ( $uuids as $uuid ) { |
26 | $queries[] = [ 'rev_type_id' => $uuid ]; |
27 | } |
28 | |
29 | $found = $this->storage->findMulti( |
30 | 'PostRevision', |
31 | $queries, |
32 | [ 'sort' => 'rev_id', 'order' => 'DESC', 'limit' => 1 ] |
33 | ); |
34 | |
35 | $revisions = []; |
36 | foreach ( $found as $result ) { |
37 | /** @var PostRevision $revision */ |
38 | $revision = reset( $result ); |
39 | $revisions[$revision->getPostId()->getAlphadecimal()] = $revision; |
40 | } |
41 | |
42 | return $revisions; |
43 | } |
44 | } |