[DDC-904] No identifier/primary key specified for Entity with inheritance Created: 01/Dec/10  Updated: 05/Jan/11  Resolved: 30/Dec/10

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: Git Master
Fix Version/s: Git Master
Security Level: All

Type: Bug Priority: Major
Reporter: Clément JOBEILI Assignee: Roman S. Borschel
Resolution: Invalid Votes: 0
Labels: None

Mac, MySQL, PHP 5.3.3



I think i found a little bug with doctrine and the inheritance on differente Symfony2 Bundle.

Here is the pb :

I use the DoctrineUserBundle (https://github.com/knplabs/DoctrineUserBundle) for one of my testing application, it's provide a nice way to handle user and session management trough a Symfony2 app.

I create an DoctrineUserBundle in my own Application Folder and I create an User sub class that inherit the User base class in the bundle with the annotation way.
When I run the doctrine:generate:entities command it's telling me:

No identifier/primary key specified for Entity 'Application\DoctrineUserBundle\Entity\User'. Every Entity must have an identifier/primary key.

But the User (base class of DoctrineUserBundle) has a primary key but with the xml way.

Do you think it's a bug ?

Thanks a lot

Comment by Benjamin Eberlei [ 01/Dec/10 ]

Now i get it. This is not a bug.

You cannot mix mappings from annotations and xml to define a single entity mapping. Its not possible.

Comment by Benjamin Eberlei [ 01/Dec/10 ]

One Solution would be to add annotations to the User bae class. That would have to be on the DoctrineUserBundle then.

Comment by Clément JOBEILI [ 01/Dec/10 ]

Ok ! Thanks but one thing is that the creator of this bundle (ornicar) has created a website called lichess.org and use DoctrineUserBundle.

In this app, he created a User.php sub classing the Base User of DoctrineUserBundle and he used annotations but with mongodb


How it's possible that it works with ODM and not with ORM ?

THanks a lot for your time

Comment by Benjamin Eberlei [ 02/Dec/10 ]

Hm maybe its a bug with mapped superclasses. I thought Ornicar did a little hack there regarding mixing.

But in general ORM != ODM.

Comment by Benjamin Eberlei [ 30/Dec/10 ]

That bug happens when the Doctrine UserBundle is not detected correctly.

It should be fixed with the current Symfony2 state of code.

Comment by Joaquín Bravo Contreras [ 04/Jan/11 ]

So now we are able to mix mappings or something else was fixed.

Because right now I'm getting the same error using latest symfony-sandbox code.

Comment by Benjamin Eberlei [ 05/Jan/11 ]

read the master docs of symfony2 please, there was a change in configuration:


Generated at Wed Oct 07 11:52:26 EDT 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.