Skip to content

Commit

Permalink
Only use CachedReader if available.
Browse files Browse the repository at this point in the history
  • Loading branch information
demiankatz committed Mar 23, 2023
1 parent 55e0a85 commit 394ef78
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Service/DriverFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,14 @@ protected function createDriver(ContainerInterface $container, Driver $options):
is_a($class, MongoODMAnnotationDriver::class, true)
)
) {
$reader = new Annotations\AnnotationReader();
$reader = new Annotations\CachedReader(
new Annotations\IndexedReader($reader),
$container->get($options->getCache())
);
if (class_exists(Annotations\CachedReader::class)) {
$reader = new Annotations\CachedReader(
new Annotations\IndexedReader($reader),
$container->get($options->getCache())
);
} else {
$reader = new Annotations\AnnotationReader();
}
$driver = new $class($reader, $paths);
} else {
$driver = new $class($paths);
Expand Down

0 comments on commit 394ef78

Please sign in to comment.