[DDC-1614] On OneToOne mappings with Primary Key same as Foreign Key, using @Id in the foreign association does not carry over when running "generate-entities" with --generate-annotations=1 Created: 22/Jan/12  Updated: 23/Jan/13

Status: Open
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers, ORM, Tools
Affects Version/s: 2.1.1
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Trivial
Reporter: Ryan Fink Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Fedora 15, php 5.3.8



 Description   

When having a OneToOne mapping that has a primary key that is the same as the foreign key, using the @Id attribute does not carry over when generating entities.

Example code:

class User
{
/**

  • @Id @Column(type="integer", nullable=false, columnDefinition="INT UNSIGNED NOT NULL AUTO_INCREMENT")
  • @GeneratedValue(strategy="AUTO")
    */
    private $id;

/**

  • @OneToOne(targetEntity="User_ExtraAttrs", cascade= {"persist","remove","detach","merge","refresh"}

    , mappedBy="User")

  • @JoinColumn(name="id", referencedColumnName="id")
    */
    private $UserAttrs;
    }

class User_ExtraAttrs
{
/**

  • @OneToOne(targetEntity="User", cascade= {"all"}

    , inversedBy="UserAttrs")

  • @Id
  • @JoinColumn(name="VehicleID", referencedColumnName="VehicleID")
    */
    private $User;
    }

When running "doctrine orm:generate-entities --regenerate-entities=1 --generate-annotations=1", the @Id in User_ExtraAttrs does not carry over. It must be manually inserted.


Generated at Sat Jul 26 11:12:51 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.