File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 15
15
use Doctrine \Common \Annotations \CachedReader ;
16
16
use Doctrine \Common \Annotations \Reader ;
17
17
use Doctrine \Common \Cache \ArrayCache ;
18
+ use Doctrine \Common \Cache \CacheProvider ;
18
19
use Psr \Cache \CacheItemPoolInterface ;
20
+ use Symfony \Component \Cache \Adapter \ArrayAdapter ;
21
+ use Symfony \Component \Cache \DoctrineProvider ;
19
22
use Symfony \Component \Translation \TranslatorInterface as LegacyTranslatorInterface ;
20
23
use Symfony \Component \Validator \Context \ExecutionContextFactory ;
21
24
use Symfony \Component \Validator \Exception \LogicException ;
@@ -197,11 +200,15 @@ public function enableAnnotationMapping(Reader $annotationReader = null)
197
200
}
198
201
199
202
if (null === $ annotationReader ) {
200
- if (!class_exists (AnnotationReader::class) || !class_exists (ArrayCache ::class)) {
203
+ if (!class_exists (AnnotationReader::class) || !class_exists (CacheProvider ::class)) {
201
204
throw new LogicException ('Enabling annotation based constraint mapping requires the packages doctrine/annotations and doctrine/cache to be installed. ' );
202
205
}
203
206
204
- $ annotationReader = new CachedReader (new AnnotationReader (), new ArrayCache ());
207
+ if (class_exists (ArrayAdapter::class)) {
208
+ $ annotationReader = new CachedReader (new AnnotationReader (), new DoctrineProvider (new ArrayAdapter ()));
209
+ } else {
210
+ $ annotationReader = new CachedReader (new AnnotationReader (), new ArrayCache ());
211
+ }
205
212
}
206
213
207
214
$ this ->annotationReader = $ annotationReader ;
You can’t perform that action at this time.
0 commit comments