Using annotations for Doctrine metadata

Doctrine can read Enitiy/Document mapping metadata from docBlocks. You’ll need then some extra configuration:

Put this somewhere in your bootstrap file, after having loaded your Doctrine*ServiceProvider. The order is important because of the automatic registration of doctrine classes autoloading.

If you have manually registered the autoloading of Doctrine files, you can put this whereveryou want after the autoload registration.


use Doctrine\Common\Annotations\AnnotationRegistry;

AnnotationRegistry::registerLoader(function($class) use ($loader) {
    return class_exists($class, false);

Table Of Contents

Previous topic

Welcome to Knp Doctrine ServiceProviders documentation!

Next topic


This Page