Skip to content

Commit d284d91

Browse files
committed
Composer: use nette/di directly
1 parent 5a7fba7 commit d284d91

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"require": {
1515
"php": ">=8.1",
16-
"contributte/di": "^0.6.0",
16+
"nette/di": "^3.1.2",
1717
"doctrine/annotations": "^1.6.1",
1818
"nettrine/cache": "^0.4.0 || ^0.5.0"
1919
},

src/DI/AnnotationsExtension.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
namespace Nettrine\Annotations\DI;
44

5-
use Contributte\DI\Extension\CompilerExtension;
65
use Doctrine\Common\Annotations\AnnotationReader;
76
use Doctrine\Common\Annotations\AnnotationRegistry;
87
use Doctrine\Common\Annotations\CachedReader;
98
use Doctrine\Common\Annotations\Reader;
109
use Doctrine\Common\Cache\Cache;
11-
use Nette\DI\Definitions\Definition;
10+
use Nette\DI\CompilerExtension;
1211
use Nette\DI\Definitions\Statement;
1312
use Nette\PhpGenerator\ClassType;
1413
use Nette\PhpGenerator\Literal;
@@ -38,9 +37,6 @@ public function getConfigSchema(): Schema
3837
]);
3938
}
4039

41-
/**
42-
* Register services
43-
*/
4440
public function loadConfiguration(): void
4541
{
4642
$builder = $this->getContainerBuilder();
@@ -56,13 +52,9 @@ public function loadConfiguration(): void
5652
}
5753

5854
if ($config->cache !== null) {
59-
$cacheName = $this->prefix('cache');
60-
$cacheDefinition = $this->getHelper()->getDefinitionFromConfig($config->cache, $cacheName);
61-
62-
// If service is extension specific, then disable autowiring
63-
if ($cacheDefinition instanceof Definition && $cacheDefinition->getName() === $cacheName) {
64-
$cacheDefinition->setAutowired(false);
65-
}
55+
$cacheDefinition = $builder->addDefinition($this->prefix('cache'));
56+
$cacheDefinition->setFactory($config->cache)
57+
->setAutowired(false);
6658
} else {
6759
$cacheDefinition = '@' . Cache::class;
6860
}

0 commit comments

Comments
 (0)