DDC-3440: <Inheritance SINGLE_TABLE> Entity merge not working with parent entity #4242

Closed
opened 2026-01-22 14:37:59 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Dec 8, 2014).

Originally assigned to: @Ocramius on GitHub.

Jira issue originally created by user briancvn:

I have problem when try to merge the ProfilePersonEntity, all the fields in ProfilePersonEntity was merged, but all another fields of parent class cannot.
I worked fine (wonderful) when i loaded with find(entity id), the DB data mapped 100% to the entity.

Please check the code below

ProfileEntity.php

/****

  • @Entity

  • @Table(name="PROFILE")

  • @InheritanceType("SINGLE_TABLE")

  • @DiscriminatorColumn(name="type", type="string")

  • @DiscriminatorMap({

  • "Profile" = "ProfileEntity", 
    
  • "ProfilePerson" = "ProfilePersonEntity",
    
  • "ProfileCompany" = "ProfileCompanyEntity"
    
  • })
    */
    class ProfileEntity extends LockableEntity {

    /****

    • @Column(name="TYPE", type="string", length=15)
      */
      private $type;

    /****

    • @Column(name="NAME", type="string", length=45)
      */
      private $name;
      ...
      }

ProfilePersonEntity.php

/****

  • @Entity
    */
    class ProfilePersonEntity extends ProfileEntity {

    /****

    • @Column(name="LAST_NAME", type="string", length=45)
      */
      private $lastName;
      ...
      }

LockableEntity.php

/*** @MappedSuperclass **/
class LockableEntity extends BaseEntity {

/*** @Column(name="LOCKED", type="string", nullable=true, length=45) **/
private $lockOwner;
...

}

BaseEntity.php

/****

  • @MappedSuperclass

  • @HasLifecycleCallbacks
    */
    class BaseEntity extends AbstractEntity {

    /****

    • @Id
    • @GeneratedValue
    • @Column(name="ID", type="integer")
      */
      private $id;

    /****

    • @Version
    • @Column(name="VERSION", type="integer")
      */
      private $version;
      ...
      }

...
$this->entityManager->merge($entity);
$this->entityManager->flush();
...

Originally created by @doctrinebot on GitHub (Dec 8, 2014). Originally assigned to: @Ocramius on GitHub. Jira issue originally created by user briancvn: I have problem when try to merge the ProfilePersonEntity, all the fields in ProfilePersonEntity was merged, but all another fields of parent class cannot. I worked fine (wonderful) when i loaded with find(entity id), the DB data mapped 100% to the entity. Please check the code below # ProfileEntity.php /**** - @Entity - @Table(name="PROFILE") - @InheritanceType("SINGLE_TABLE") - @DiscriminatorColumn(name="type", type="string") - @DiscriminatorMap({ - "Profile" = "ProfileEntity", - "ProfilePerson" = "ProfilePersonEntity", - "ProfileCompany" = "ProfileCompanyEntity" - }) */ class ProfileEntity extends LockableEntity { /**** - @Column(name="TYPE", type="string", length=15) */ private $type; /***\* - @Column(name="NAME", type="string", length=45) */ private $name; ... } # ProfilePersonEntity.php /**** - @Entity */ class ProfilePersonEntity extends ProfileEntity { /**** - @Column(name="LAST_NAME", type="string", length=45) */ private $lastName; ... } # LockableEntity.php /**\* @MappedSuperclass **/ class LockableEntity extends BaseEntity { ``` /*** @Column(name="LOCKED", type="string", nullable=true, length=45) **/ private $lockOwner; ... ``` } # BaseEntity.php /***\* - @MappedSuperclass - @HasLifecycleCallbacks */ class BaseEntity extends AbstractEntity { /**** - @Id - @GeneratedValue - @Column(name="ID", type="integer") */ private $id; /***\* - @Version - @Column(name="VERSION", type="integer") */ private $version; ... } ... $this->entityManager->merge($entity); $this->entityManager->flush(); ...
admin added the Bug label 2026-01-22 14:37:59 +01:00
admin closed this issue 2026-01-22 14:37:59 +01:00
Author
Owner

@doctrinebot commented on GitHub (Dec 8, 2014):

Comment created by @ocramius:

Cannot reproduce: missing reproducible test case.

@doctrinebot commented on GitHub (Dec 8, 2014): Comment created by @ocramius: Cannot reproduce: missing reproducible test case.
Author
Owner

@doctrinebot commented on GitHub (Dec 8, 2014):

Issue was closed with resolution "Cannot Reproduce"

@doctrinebot commented on GitHub (Dec 8, 2014): Issue was closed with resolution "Cannot Reproduce"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4242