Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-904

No identifier/primary key specified for Entity with inheritance

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: Git Master
    • Fix Version/s: Git Master
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None
    • Environment:
      Mac, MySQL, PHP 5.3.3

      Description

      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

        Activity

        Hide
        Benjamin Eberlei added a comment -

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

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

        Show
        Benjamin Eberlei added a comment - read the master docs of symfony2 please, there was a change in configuration: http://docs.symfony-reloaded.org/master/guides/doctrine/orm/overview.html
        Hide
        Joaquín Bravo Contreras added a comment -

        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.

        Show
        Joaquín Bravo Contreras added a comment - 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.
        Hide
        Benjamin Eberlei added a comment -

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

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

        Show
        Benjamin Eberlei added a comment - That bug happens when the Doctrine UserBundle is not detected correctly. It should be fixed with the current Symfony2 state of code.
        Hide
        Benjamin Eberlei added a comment -

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

        But in general ORM != ODM.

        Show
        Benjamin Eberlei added a comment - Hm maybe its a bug with mapped superclasses. I thought Ornicar did a little hack there regarding mixing. But in general ORM != ODM.
        Hide
        Clément JOBEILI added a comment - - edited

        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

        Show
        Clément JOBEILI added a comment - - edited 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
        Hide
        Benjamin Eberlei added a comment -

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

        Show
        Benjamin Eberlei added a comment - One Solution would be to add annotations to the User bae class. That would have to be on the DoctrineUserBundle then.
        Hide
        Benjamin Eberlei added a comment -

        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.

        Show
        Benjamin Eberlei added a comment - 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.

          People

          • Assignee:
            Roman S. Borschel
            Reporter:
            Clément JOBEILI
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: