Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
PostRevisionBoardHistoryStorage
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 find
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace Flow\Data\Storage;
4
5use Flow\Model\UUID;
6
7class PostRevisionBoardHistoryStorage extends BoardHistoryStorage {
8    /**
9     * @param array $attributes
10     * @param array $options
11     * @return array
12     */
13    public function find( array $attributes, array $options = [] ) {
14        $attributes = $this->preprocessSqlArray( $attributes );
15
16        $dbr = $this->dbFactory->getDB( DB_REPLICA );
17        $res = $dbr->newSelectQueryBuilder()
18            ->select( '*' )
19            ->from( 'flow_topic_list' )
20            ->join( 'flow_tree_node', null, 'topic_id = tree_ancestor_id' )
21            ->join( 'flow_tree_revision', null, 'tree_descendant_id = tree_rev_descendant_id' )
22            ->join( 'flow_revision', null, 'tree_rev_id = rev_id' )
23            ->where( [ 'rev_type' => 'post' ] )
24            ->andWhere( $attributes )
25            ->options( $options )
26            ->caller( __METHOD__ )
27            ->fetchResultSet();
28
29        $retval = [];
30        foreach ( $res as $row ) {
31            $row = UUID::convertUUIDs( (array)$row, 'alphadecimal' );
32            $retval[$row['rev_id']] = $row;
33        }
34
35        return $retval;
36    }
37}