dflydev / dflydev-doctrine-orm-service-provider

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

Better explanation about the use_simple_annotation_reader #2

Closed Taluu closed 12 years ago

Taluu commented 12 years ago

Differences for the usage of the simple annotation reader. If it is not activated, then everything will work, as long as it can be autoloaded.

I think maybe you should specify that when you do not use the simple annotation reader, then you should register your autoloader (composer, ... whatever) with the following (if it's composer, as it need to be adapted) :

<?php
// ...

$loader = require __DIR__ . '/../vendor/autoload.php';

\Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

I think maybe trying to create an "autoloader" service provider for Silex (as this was removed), and checking if there is such a service provider could be maybe be useful to register it automatically ? Like the following :

<?php
// ...

if (isset($app['autoloader'])) {
   \Doctrine\Common\Annotations\AnnotationRegistry::registerLoader($app['autoloader']);
}

But it's up to you. :)