After testign several combinations I found out that the issue comes from 
the fact that use statement are not processed properly : 
 use Doctrine\ORM\Mapping as ORM;

with 
@ORM\Entity

does not work but 

 use Doctrine\ORM\Mapping\ORM;

with 
@Entity

does

Le jeudi 11 février 2016 08:50:16 UTC+1, Shadowalker a écrit :
>
> Hello,
>
> I'm having issues getting the metadata from my entities to be discovered
>
> I have psr4 autoload defined as such :
>
> "autoload": {
>         "psr-4": {
>             "My\\Namespace\\": "src/main/php/"
>         }
>     },
>
> I am trying to load my database into a sqlite file based db using the 
> following.
>
>  $configuration = Setup::createAnnotationMetadataConfiguration([__DIR__ . 
> '/../../../main/php/Model'], true);
>             //$configuration->addEntityNamespace('Model', 'My\
> Namespace\Model');
>
>
>             // obtaining the entity manager
>             static::$entityManager = EntityManager::create(
>                 ['driver' => 'pdo_sqlite', 'path' => __DIR__ . 
> '/../db.sqlite'], $configuration
>             );
>
>
>             //$tool = new SchemaTool(static::$entityManager);
>             $classes = static::$entityManager->getMetaDataFactory()->
> getAllMetaData();
>
>
>             var_dump($classes);
>
>
> Note that *__DIR__ . **'/../../../main/php/Model* points to my entities 
> location and that doctrine sees the file correctly
> but once it the process arrives at AnnotationDriver::getAllClassesNames 
> (l.242 : get_declared_classes) it cannot find them being loaded.
>
> I figure it might have to do with support issues for psr4 but I'd like to 
> stick to psr 4 and I'm just looking for a way to make doctrine see my 
> entities (without hacking into the doctrine source code)
>
> P.S. : I tested this with both 2.5.4 and dev-master versions
>
> Any help in solving this issue would be greatly appreciated.
>
>
> Cheers.
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to