22
33namespace Nettrine \Annotations \DI ;
44
5- use Contributte \DI \Extension \CompilerExtension ;
65use Doctrine \Common \Annotations \AnnotationReader ;
76use Doctrine \Common \Annotations \AnnotationRegistry ;
87use Doctrine \Common \Annotations \CachedReader ;
98use Doctrine \Common \Annotations \Reader ;
109use Doctrine \Common \Cache \Cache ;
11- use Nette \DI \Definitions \ Definition ;
10+ use Nette \DI \CompilerExtension ;
1211use Nette \DI \Definitions \Statement ;
1312use Nette \PhpGenerator \ClassType ;
1413use 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