Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6469859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:02:33+00:00 2026-05-25T06:02:33+00:00

How (if possible at all) do you change the entity type with Doctrine2, using

  • 0

How (if possible at all) do you change the entity type with Doctrine2, using it’s Class Table Inheritance?

Let’s say I have a Person parent class type and two inherited types Employe and Client. My system allows to create a Person and specify it’s type – that’s fairly easy to implement – but I’d also like to be able to change the person from an Employe to a Client, while maintaining the Person-level information (it’s id and other associated records).

Is there a simple way to do this with Doctrine2?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:02:33+00:00Added an answer on May 25, 2026 at 6:02 am

    I was looking for this behaviour yesterday also.

    In the end, after speaking with people in #doctrine on freenode, I was told that it is not possible.

    If you want to do this, then you have to go through this:

    Upgrading a User

    1. Grab the Person Entity.
    2. Update the discrimator column so that it is no longer a ‘person’ and change it to ’employee’
    3. Create a corresponding row inyour Employee table for this inheritance.

    Removing Inheritance

    Likewise if you want to remove inheritance, you have to..

    1. Grab the Person Entity.
    2. Update the discrimnator column so that it is no longer an ’employee’ and change it to a ‘person’.
    3. Delete the corresponding row in your Employee table. (Yes you have to delete it, just change the discrimator coumn is not sufficient).

    This might be 7 months late, but it is at least the correct answer for anything else looking to suport such a feature.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table and a corresponding entity class (POCO with change tracking
Is it at all possible to do database-agnostic table dumps/hydrates? I don't have any
Is the following at all possible in c#? I have the following but the
I was wondering if it is at all possible to change the Graphic used
I have a requirement to store all versions of an entity in a easily
Problem I have a @MappedSuperclass called Data as the parent of every Entity in
I have the following entities: @Entity public class Alert implements Serializable { private long
Question: Is it possible to (automatically) change the base class of auto-generated domain objects
The situation is that I have a table that models an entity. This entity
All, We have 300 entity classes that was generated from existing DB schema for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.