dflydev / dflydev-doctrine-orm-service-provider

Doctrine ORM Service Provider
MIT License
209 stars 59 forks source link

[WIP][feature] Use the annotation cache metadata #52

Open liuggio opened 9 years ago

liuggio commented 9 years ago

in production is useful to let the user configure an annotation cache


$cache = new ApcCache(); //or whatever

AnnotationRegistry::registerFile(__DIR__ . '/Mapping/Driver/DoctrineAnnotations.php');

        if ($useSimpleAnnotationReader) {
            // Register the ORM Annotations in the AnnotationRegistry
            $reader = new SimpleAnnotationReader();
            $reader->addNamespace('Doctrine\ORM\Mapping');
            $cachedReader = new CachedReader($reader, $cache);

            return new AnnotationDriver($cachedReader, (array) $paths);
        }

        return new AnnotationDriver(
            new CachedReader(new AnnotationReader(), $cache),
            (array) $paths
        );

Is WIP because it should be improved: