Issues (131)

src/Test/LazyManagerRegistry.php (1 issue)

Severity
1
<?php
2
3
namespace Zenstruck\Foundry\Test;
4
5
use Doctrine\Persistence\ManagerRegistry;
6
use Doctrine\Persistence\ObjectManager;
7
use Doctrine\Persistence\ObjectRepository;
8
9
/**
10
 * @internal
11
 *
12
 * @author Kevin Bond <[email protected]>
13
 */
14
final class LazyManagerRegistry implements ManagerRegistry
15
{
16 634
    private $callback;
17
18 634
    public function __construct(callable $callback)
19 634
    {
20
        $this->callback = $callback;
21
    }
22
23
    public function getDefaultConnectionName(): string
24
    {
25
        return $this->inner()->getDefaultConnectionName();
26
    }
27
28
    public function getConnection($name = null): object
29
    {
30
        return $this->inner()->getConnection($name);
31
    }
32
33
    public function getConnections(): array
34
    {
35
        return $this->inner()->getConnections();
36
    }
37
38
    public function getConnectionNames(): array
39
    {
40
        return $this->inner()->getConnectionNames();
41
    }
42
43
    public function getDefaultManagerName(): string
44
    {
45
        return $this->inner()->getDefaultManagerName();
46
    }
47
48
    public function getManager($name = null): ObjectManager
49
    {
50
        return $this->inner()->getManager($name);
51
    }
52
53
    public function getManagers(): array
54
    {
55
        return $this->inner()->getManagers();
56
    }
57
58
    public function resetManager($name = null): ObjectManager
59
    {
60
        return $this->inner()->resetManager($name);
61
    }
62
63
    public function getAliasNamespace($alias): string
64
    {
65
        return $this->inner()->getAliasNamespace($alias);
0 ignored issues
show
Deprecated Code introduced by
The function Doctrine\Persistence\Man...ry::getAliasNamespace() has been deprecated: This method is deprecated along with short namespace aliases. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

65
        return /** @scrutinizer ignore-deprecated */ $this->inner()->getAliasNamespace($alias);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
66
    }
67
68
    public function getManagerNames(): array
69
    {
70
        return $this->inner()->getManagerNames();
71 350
    }
72
73 350
    public function getRepository($persistentObject, $persistentManagerName = null): ObjectRepository
74
    {
75
        return $this->inner()->getRepository($persistentObject, $persistentManagerName);
76 488
    }
77
78 488
    public function getManagerForClass($class): ?ObjectManager
79
    {
80
        return $this->inner()->getManagerForClass($class);
81 588
    }
82
83 588
    private function inner(): ManagerRegistry
84
    {
85
        return ($this->callback)();
86
    }
87
}
88