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

        Clément JOBEILI created issue -
        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.
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Won't Fix [ 2 ]
        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
        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
        Clément JOBEILI made changes -
        Resolution Won't Fix [ 2 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        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
        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.
        Benjamin Eberlei made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]
        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 -

        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
        Benjamin Eberlei made changes -
        Workflow jira [ 12179 ] jira-feedback [ 14666 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 14666 ] jira-feedback2 [ 16530 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 16530 ] jira-feedback3 [ 18783 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-904, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          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: