1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace AbterPhp\Files\Orm; |
6
|
|
|
|
7
|
|
|
use AbterPhp\Admin\Domain\Entities\User; |
8
|
|
|
use AbterPhp\Files\Domain\Entities\File; |
9
|
|
|
use AbterPhp\Files\Domain\Entities\FileDownload as Entity; |
10
|
|
|
use AbterPhp\Files\Orm\DataMappers\FileDownloadSqlDataMapper; // @phan-suppress-current-line PhanUnreferencedUseNormal |
11
|
|
|
use AbterPhp\Framework\Orm\IGridRepo; |
12
|
|
|
use Opulence\Orm\Repositories\Repository; |
13
|
|
|
|
14
|
|
|
class FileDownloadRepo extends Repository implements IGridRepo |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @param int $limitFrom |
18
|
|
|
* @param int $pageSize |
19
|
|
|
* @param string[] $orders |
20
|
|
|
* @param array $conditions |
21
|
|
|
* @param array $params |
22
|
|
|
* |
23
|
|
|
* @return Entity[] |
24
|
|
|
* @throws \Opulence\Orm\OrmException |
25
|
|
|
*/ |
26
|
|
|
public function getPage(int $limitFrom, int $pageSize, array $orders, array $conditions, array $params): array |
27
|
|
|
{ |
28
|
|
|
/** @see FileDownloadSqlDataMapper::getPage() */ |
29
|
|
|
return $this->getFromDataMapper('getPage', [$limitFrom, $pageSize, $orders, $conditions, $params]); |
|
|
|
|
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @param File $file |
34
|
|
|
* |
35
|
|
|
* @return Entity[] |
36
|
|
|
* @throws \Opulence\Orm\OrmException |
37
|
|
|
*/ |
38
|
|
|
public function getByFile(File $file): array |
39
|
|
|
{ |
40
|
|
|
/** @see FileDownloadSqlDataMapper::getByFileId() */ |
41
|
|
|
return $this->getFromDataMapper('getByFileId', [$file->getId()]); |
|
|
|
|
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @param User $user |
46
|
|
|
* |
47
|
|
|
* @return Entity[] |
48
|
|
|
* @throws \Opulence\Orm\OrmException |
49
|
|
|
*/ |
50
|
|
|
public function getByUser(User $user): array |
51
|
|
|
{ |
52
|
|
|
/** @see FileDownloadSqlDataMapper::getByUserId() */ |
53
|
|
|
return $this->getFromDataMapper('getByUserId', [$user->getId()]); |
|
|
|
|
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|