Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
TargetPageMapper | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
insert | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\Notifications\Mapper; |
4 | |
5 | use MediaWiki\Extension\Notifications\Model\TargetPage; |
6 | |
7 | /** |
8 | * Database mapper for TargetPage model |
9 | */ |
10 | class TargetPageMapper extends AbstractMapper { |
11 | |
12 | /** |
13 | * List of db fields used to construct an TargetPage model |
14 | * @var string[] |
15 | */ |
16 | protected static $fields = [ |
17 | 'etp_page', |
18 | 'etp_event' |
19 | ]; |
20 | |
21 | /** |
22 | * Insert an TargetPage instance into the database |
23 | * |
24 | * @param TargetPage $targetPage |
25 | * @return bool |
26 | */ |
27 | public function insert( TargetPage $targetPage ) { |
28 | $dbw = $this->dbFactory->getEchoDb( DB_PRIMARY ); |
29 | |
30 | $row = $targetPage->toDbArray(); |
31 | |
32 | $dbw->newInsertQueryBuilder() |
33 | ->insertInto( 'echo_target_page' ) |
34 | ->row( $row ) |
35 | ->caller( __METHOD__ ) |
36 | ->execute(); |
37 | |
38 | return true; |
39 | } |
40 | } |