File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 16
16
use Doctrine \Common \Annotations \Reader ;
17
17
use Doctrine \Common \Cache \ArrayCache ;
18
18
use Psr \Cache \CacheItemPoolInterface ;
19
+ use Symfony \Component \Cache \Adapter \ArrayAdapter ;
20
+ use Symfony \Component \Cache \DoctrineProvider ;
19
21
use Symfony \Component \Validator \Context \ExecutionContextFactory ;
20
22
use Symfony \Component \Validator \Exception \ValidatorException ;
21
23
use Symfony \Component \Validator \Mapping \Factory \LazyLoadingMetadataFactory ;
@@ -266,7 +268,11 @@ public function setDoctrineAnnotationReader(?Reader $reader): self
266
268
*/
267
269
public function addDefaultDoctrineAnnotationReader (): self
268
270
{
269
- $ this ->annotationReader = new CachedReader (new AnnotationReader (), new ArrayCache ());
271
+ if (class_exists (ArrayAdapter::class)) {
272
+ $ this ->annotationReader = new CachedReader (new AnnotationReader (), new DoctrineProvider (new ArrayAdapter ()));
273
+ } else {
274
+ $ this ->annotationReader = new CachedReader (new AnnotationReader (), new ArrayCache ());
275
+ }
270
276
271
277
return $ this ;
272
278
}
You can’t perform that action at this time.
0 commit comments