10 Answers
10

If it matters, I'm using Doctrine 2.2.1. Anyway, I'm just adding a bit more information on this topic.

I dug around the Doctrine\Configuration.php class to see how newDefaultAnnotationDriver created the AnnotationDriver. The method begins on line 125, but the relevant part is line 145 to 147 if you're using the latest version of the Common library.

I couldn't actually find the setDefaultAnnotationNamespace method in AnnotationReader class. So that was weird. But I'm assuming it sets the namespace Doctrine\Orm\Mapping, so that annotations in that namespace don't need to be prefixed. Hence the error since it seems the doctrine cli tool generates the entities differently. I'm not sure why that is.

You are a life saver. I had used an old Symfony project to generate the entity mappings directly from the database tables and just copied the entity classes over to this new Doctrine project. Your answer was spot on. I did a find "@ORM\" and replace "@" on my entity classes and voila. Now I actually have entity metadata showing in the doctrine console.
–
CodezillaMay 24 '14 at 22:17

Below is the documentation for the method createAnnotationMetadataConfiguration. I have just dig into the source code. By default it uses a simple annotation reader, which means you don't need to have ORM\ in front of your annotation, you can do @Entities instead of @ORM\Entities. So all you need to do here is to disable it using simple annotation reader.

I hit a similar issue (although the other way around), when upgrading from Doctrine 2.0 to Doctrine 2.1 (or 2.2). For Doctrine 2.0 my annotations using @Table worked fine, but after upgrade it started to complain that annotation was not loaded. I suggest you give Doctrine 2.2 a go, in order to use @ORM\Table