Are you using the simplified annotation loader? That's the one that is
created by default via:
 *
https://github.com/doctrine/doctrine2/blob/788143dc0313c7522820ebf6057f73881e7190a3/lib/Doctrine/ORM/Tools/Setup.php#L69
 *
https://github.com/doctrine/doctrine2/blob/788143dc0313c7522820ebf6057f73881e7190a3/lib/Doctrine/ORM/Configuration.php#L152

The simplified annotation reader does not understand import statements.

See
http://doctrine-common.readthedocs.org/en/latest/reference/annotations.html#default-namespace

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 11 February 2016 at 17:47, Shadowalker <[email protected]> wrote:

> 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.
>

-- 
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