Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 3 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
EntityManagerTrait | |
0.00% |
0 / 3 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
entityManager | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
setEntityManager | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Olz\Utils; |
4 | |
5 | use Doctrine\ORM\EntityManagerInterface; |
6 | use Symfony\Contracts\Service\Attribute\Required; |
7 | |
8 | trait EntityManagerTrait { |
9 | protected function entityManager(): EntityManagerInterface { |
10 | $util = WithUtilsCache::get('entityManager'); |
11 | assert($util); |
12 | return $util; |
13 | } |
14 | |
15 | #[Required] |
16 | public function setEntityManager(EntityManagerInterface $new): void { |
17 | WithUtilsCache::set('entityManager', $new); |
18 | } |
19 | } |