DDC-904: No identifier/primary key specified for Entity with inheritance #5431

Closed
doctrinebot opened this Issue Dec 1, 2010 · 8 comments

1 participant

@doctrinebot

Jira issue originally created by user dator:

Hi,

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

@doctrinebot

Comment created by @beberlei:

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.

@doctrinebot

Comment created by @beberlei:

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

@doctrinebot

Comment created by dator:

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

https://github.com/ornicar/lichess/blob/master/src/Application/DoctrineUserBundle/Document/User.php

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

THanks a lot for your time :)

@doctrinebot

Comment created by @beberlei:

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

But in general ORM != ODM.

@doctrinebot

Comment created by @beberlei:

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

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

@doctrinebot

Issue was closed with resolution "Invalid"

@doctrinebot

Comment created by jackbravo:

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.

@doctrinebot

Comment created by @beberlei:

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

http://docs.symfony-reloaded.org/master/guides/doctrine/orm/overview.html

@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment