diff options
Diffstat (limited to 'vendor/doctrine/persistence/src/Persistence/ObjectRepository.php')
-rw-r--r-- | vendor/doctrine/persistence/src/Persistence/ObjectRepository.php | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/vendor/doctrine/persistence/src/Persistence/ObjectRepository.php b/vendor/doctrine/persistence/src/Persistence/ObjectRepository.php new file mode 100644 index 0000000..a714731 --- /dev/null +++ b/vendor/doctrine/persistence/src/Persistence/ObjectRepository.php | |||
@@ -0,0 +1,73 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Doctrine\Persistence; | ||
6 | |||
7 | use UnexpectedValueException; | ||
8 | |||
9 | /** | ||
10 | * Contract for a Doctrine persistence layer ObjectRepository class to implement. | ||
11 | * | ||
12 | * @template-covariant T of object | ||
13 | */ | ||
14 | interface ObjectRepository | ||
15 | { | ||
16 | /** | ||
17 | * Finds an object by its primary key / identifier. | ||
18 | * | ||
19 | * @param mixed $id The identifier. | ||
20 | * | ||
21 | * @return object|null The object. | ||
22 | * @psalm-return T|null | ||
23 | */ | ||
24 | public function find($id); | ||
25 | |||
26 | /** | ||
27 | * Finds all objects in the repository. | ||
28 | * | ||
29 | * @return array<int, object> The objects. | ||
30 | * @psalm-return T[] | ||
31 | */ | ||
32 | public function findAll(); | ||
33 | |||
34 | /** | ||
35 | * Finds objects by a set of criteria. | ||
36 | * | ||
37 | * Optionally sorting and limiting details can be passed. An implementation may throw | ||
38 | * an UnexpectedValueException if certain values of the sorting or limiting details are | ||
39 | * not supported. | ||
40 | * | ||
41 | * @param array<string, mixed> $criteria | ||
42 | * @param array<string, string>|null $orderBy | ||
43 | * @psalm-param array<string, 'asc'|'desc'|'ASC'|'DESC'>|null $orderBy | ||
44 | * | ||
45 | * @return array<int, object> The objects. | ||
46 | * @psalm-return T[] | ||
47 | * | ||
48 | * @throws UnexpectedValueException | ||
49 | */ | ||
50 | public function findBy( | ||
51 | array $criteria, | ||
52 | ?array $orderBy = null, | ||
53 | ?int $limit = null, | ||
54 | ?int $offset = null | ||
55 | ); | ||
56 | |||
57 | /** | ||
58 | * Finds a single object by a set of criteria. | ||
59 | * | ||
60 | * @param array<string, mixed> $criteria The criteria. | ||
61 | * | ||
62 | * @return object|null The object. | ||
63 | * @psalm-return T|null | ||
64 | */ | ||
65 | public function findOneBy(array $criteria); | ||
66 | |||
67 | /** | ||
68 | * Returns the class name of the object managed by the repository. | ||
69 | * | ||
70 | * @psalm-return class-string<T> | ||
71 | */ | ||
72 | public function getClassName(); | ||
73 | } | ||