Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
AddSecondLevelCache | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
postRun | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | namespace Apie\DoctrineEntityConverter\CodeGenerators; |
3 | |
4 | use Apie\StorageMetadataBuilder\Interfaces\PostRunGeneratedCodeContextInterface; |
5 | use Apie\StorageMetadataBuilder\Interfaces\RootObjectInterface; |
6 | use Apie\StorageMetadataBuilder\Mediators\GeneratedCodeContext; |
7 | use Doctrine\ORM\Mapping\Cache; |
8 | use Nette\PhpGenerator\ClassType; |
9 | |
10 | class AddSecondLevelCache implements PostRunGeneratedCodeContextInterface |
11 | { |
12 | public function postRun(GeneratedCodeContext $generatedCodeContext): void |
13 | { |
14 | $rootObjects = $generatedCodeContext->generatedCode->generatedCodeHashmap->getObjectsWithInterface(RootObjectInterface::class); |
15 | /** @var ClassType $rootObject */ |
16 | foreach ($rootObjects as $rootObject) { |
17 | $rootObject->addAttribute(Cache::class, ['usage' => 'NONSTRICT_READ_WRITE']); |
18 | } |
19 | } |
20 | } |