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 50d5cef commit d0834d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"require": {
"php": ">=8.1",
"contributte/di": "^0.6.0",
"nette/di": "^3.1.2",
"doctrine/cache": "^1.13.0"
},
"require-dev": {
Expand Down
10 changes: 3 additions & 7 deletions src/DI/CacheExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Nettrine\Cache\DI;

use Contributte\DI\Helper\ExtensionDefinitionsHelper;
use Doctrine\Common\Cache\ApcuCache;
use Doctrine\Common\Cache\Cache;
use Doctrine\Common\Cache\PhpFileCache;
Expand Down Expand Up @@ -35,11 +34,9 @@ public function loadConfiguration(): void
$builder = $this->getContainerBuilder();
$config = $this->config;

$driverName = $this->prefix('driver');

if ($config->driver === null) {
// auto choose
$driverDefinition = $builder->addDefinition($driverName)
$driverDefinition = $builder->addDefinition($this->prefix('driver'))
->setType(Cache::class);

if (isset($builder->parameters['tempDir'])) {
Expand All @@ -55,9 +52,8 @@ public function loadConfiguration(): void
));
}
} else {
// load from config
$definitionsHelper = new ExtensionDefinitionsHelper($this->compiler);
$definitionsHelper->getDefinitionFromConfig($config->driver, $driverName);
$builder->addDefinition($this->prefix('driver'))
->setFactory($config->driver);
}
}

Expand Down

0 comments on commit d0834d2

Please sign in to comment.