Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
MediaInfoEntityQuery | |
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
getConditionForEntityId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getEntityIdStringFromRow | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getFieldsNeededForMapping | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Wikibase\MediaInfo\Services; |
4 | |
5 | use Wikibase\DataModel\Entity\EntityId; |
6 | use Wikibase\Lib\Store\Sql\PageTableEntityQueryBase; |
7 | |
8 | /** |
9 | * PageTableEntityQuery that assumes the entity IDs numeric part matches page_id of the page |
10 | * that the MediaInfo item occupies a slot on. |
11 | * |
12 | * For example: An MediaInfo item with ID M999 will occupy a slot on a Page with id 999 |
13 | * |
14 | * @license GPL-2.0-or-later |
15 | */ |
16 | class MediaInfoEntityQuery extends PageTableEntityQueryBase { |
17 | |
18 | /** |
19 | * @param EntityId $entityId |
20 | * @return array SQL condition |
21 | */ |
22 | protected function getConditionForEntityId( EntityId $entityId ) { |
23 | '@phan-var \Wikibase\MediaInfo\DataModel\MediaInfoId $entityId'; |
24 | return [ 'page_id' => $entityId->getNumericId() ]; |
25 | } |
26 | |
27 | protected function getEntityIdStringFromRow( \stdClass $row ) { |
28 | return 'M' . $row->page_id; |
29 | } |
30 | |
31 | protected function getFieldsNeededForMapping() { |
32 | return [ 'page_id' ]; |
33 | } |
34 | |
35 | } |