Conditions | 1 |
Paths | 1 |
Total Lines | 18 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | protected function getMediaFiles(string $ownerName, int $ownerId, string $ownerAttribute, array $paginationOptions = []) |
||
24 | { |
||
25 | $mediafilesQuery = OwnerMediafile::getMediaFilesQuery([ |
||
26 | 'owner' => $ownerName, |
||
27 | 'ownerId' => $ownerId, |
||
28 | 'ownerAttribute' => $ownerAttribute, |
||
29 | ]); |
||
30 | $pagination = new Pagination(array_merge([ |
||
31 | 'defaultPageSize' => Yii::$app->params['defaultPageSize'], |
||
32 | 'totalCount' => $mediafilesQuery->count() |
||
33 | ], $paginationOptions) |
||
34 | ); |
||
35 | |||
36 | return [ |
||
37 | 'items' => $mediafilesQuery->offset($pagination->offset) |
||
38 | ->limit($pagination->limit) |
||
39 | ->all(), |
||
40 | 'pagination' => $pagination |
||
41 | ]; |
||
61 |