Skip to content

Commit

Permalink
Composer: use nette/di directly
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed Jul 3, 2023
1 parent 5a7fba7 commit d284d91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"require": {
"php": ">=8.1",
"contributte/di": "^0.6.0",
"nette/di": "^3.1.2",
"doctrine/annotations": "^1.6.1",
"nettrine/cache": "^0.4.0 || ^0.5.0"
},
Expand Down
16 changes: 4 additions & 12 deletions src/DI/AnnotationsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

namespace Nettrine\Annotations\DI;

use Contributte\DI\Extension\CompilerExtension;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\Common\Annotations\CachedReader;
use Doctrine\Common\Annotations\Reader;
use Doctrine\Common\Cache\Cache;
use Nette\DI\Definitions\Definition;
use Nette\DI\CompilerExtension;
use Nette\DI\Definitions\Statement;
use Nette\PhpGenerator\ClassType;
use Nette\PhpGenerator\Literal;
Expand Down Expand Up @@ -38,9 +37,6 @@ public function getConfigSchema(): Schema
]);
}

/**
* Register services
*/
public function loadConfiguration(): void
{
$builder = $this->getContainerBuilder();
Expand All @@ -56,13 +52,9 @@ public function loadConfiguration(): void
}

if ($config->cache !== null) {
$cacheName = $this->prefix('cache');
$cacheDefinition = $this->getHelper()->getDefinitionFromConfig($config->cache, $cacheName);

// If service is extension specific, then disable autowiring
if ($cacheDefinition instanceof Definition && $cacheDefinition->getName() === $cacheName) {
$cacheDefinition->setAutowired(false);
}
$cacheDefinition = $builder->addDefinition($this->prefix('cache'));
$cacheDefinition->setFactory($config->cache)
->setAutowired(false);
} else {
$cacheDefinition = '@' . Cache::class;
}
Expand Down

0 comments on commit d284d91

Please sign in to comment.