1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
/** |
4
|
|
|
* Minotaur |
5
|
|
|
* |
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not |
7
|
|
|
* use this file except in compliance with the License. You may obtain a copy of |
8
|
|
|
* the License at |
9
|
|
|
* |
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
11
|
|
|
* |
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
14
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
15
|
|
|
* License for the specific language governing permissions and limitations under |
16
|
|
|
* the License. |
17
|
|
|
* |
18
|
|
|
* @copyright 2015-2017 Appertly |
19
|
|
|
* @license Apache-2.0 |
20
|
|
|
*/ |
21
|
|
|
namespace Minotaur\Db; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Resolves DbRef objects |
25
|
|
|
*/ |
26
|
|
|
interface DbRefResolver |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* Gets whether or not this class supports the reference type. |
30
|
|
|
* |
31
|
|
|
* @param $ref - The reference type (usually a MongoDB collection name) |
32
|
|
|
* @return - `true` if the reference type is supported |
|
|
|
|
33
|
|
|
*/ |
34
|
|
|
public function isResolvable(string $ref): bool; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Resolves a MongoDB DbRef. |
38
|
|
|
* |
39
|
|
|
* @param array<string,mixed> $ref - The DbRef to load |
40
|
|
|
* @return - The loaded entity or `null` if not found |
|
|
|
|
41
|
|
|
* @throws \InvalidArgumentException If `$ref` is of an unsupported type |
42
|
|
|
* @throws \Caridea\Dao\Exception\Unreachable If the connection fails |
43
|
|
|
* @throws \Caridea\Dao\Exception\Unretrievable If the result cannot be retrieved |
44
|
|
|
* @throws \Caridea\Dao\Exception\Generic If any other database problem occurs |
45
|
|
|
*/ |
46
|
|
|
public function resolve(array $ref); |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Resolves a MongoDB DbRef. |
50
|
|
|
* |
51
|
|
|
* @param iterable<array<string,mixed>> $refs The DbRefs to load |
|
|
|
|
52
|
|
|
* @return \Traversable<mixed> The loaded entities |
|
|
|
|
53
|
|
|
* @throws \InvalidArgumentException If any `$ref`s are of an unsupported type |
54
|
|
|
* @throws \Caridea\Dao\Exception\Unreachable If the connection fails |
55
|
|
|
* @throws \Caridea\Dao\Exception\Unretrievable If the result cannot be retrieved |
56
|
|
|
* @throws \Caridea\Dao\Exception\Generic If any other database problem occurs |
57
|
|
|
*/ |
58
|
|
|
public function resolveAll(iterable $refs): iterable; |
59
|
|
|
} |
60
|
|
|
|
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.