| Total Complexity | 7 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | class Repository implements RepositoryInterface |
||
| 18 | 910 | { |
|
| 19 | /** |
||
| 20 | * Create repository linked to one specific selector. |
||
| 21 | * |
||
| 22 | * @param Select<TEntity> $select |
||
| 23 | */ |
||
| 24 | public function __construct( |
||
| 25 | /** @readonly */ |
||
| 26 | 24 | protected Select $select, |
|
| 27 | ) { |
||
| 28 | 24 | } |
|
| 29 | |||
| 30 | /** |
||
| 31 | 192 | * Repositories are always immutable by default. |
|
| 32 | */ |
||
| 33 | 192 | public function __clone() |
|
| 34 | { |
||
| 35 | $this->select = clone $this->select; |
||
| 36 | 614 | } |
|
| 37 | |||
| 38 | 614 | public function findByPK($id): ?object |
|
| 39 | { |
||
| 40 | return $this->select()->wherePK($id)->fetchOne(); |
||
| 41 | 56 | } |
|
| 42 | |||
| 43 | 56 | public function findOne(array $scope = []): ?object |
|
| 46 | } |
||
| 47 | |||
| 48 | public function findAll(array $scope = [], array $orderBy = []): iterable |
||
| 51 | 854 | } |
|
| 52 | |||
| 53 | /** |
||
| 54 | * Get selector associated with the repository. |
||
| 55 | * |
||
| 56 | * @return Select<TEntity> |
||
| 57 | */ |
||
| 58 | public function select(): Select |
||
| 61 | } |
||
| 62 | |||
| 63 | public function forUpdate(): static |
||
| 71 |