Forums OroPlatform OroPlatform – How do I? Questions How to extend entity with Inheritance Mapping

This topic contains 2 replies, has 2 voices, and was last updated by  thinh2010 1 year, 3 months ago.

  • Creator
  • #30668


    Hi friends,

    I have a Contact class in core code.
    Now I need create many types of Contact with some specific functions for each type.
    I decided using Class Table Inheritance. But I cannot change the Contact class, so that I decide make a class extend.

    I extended the bundle, and now I dont know how to extend the entity class to implement Class Table Inheritance (maybe must use the Migration but I dont know how to do that).

    Do you have any idea?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
  • #30669

    Mike Kudelya


    Are use sure, that you should use class table inheritance ? Can you tell me more about ‘specific functions for each type’ ? We don’t recommended extend Contact entity, but you can do this on your own risk. Also this approach has some performance impact. But if you want use it just for testing, add this to Contact entity:

    Add migration:

    Add custom entity:

    and run:



    Hi Mike,

    Thanks for your reply and solution. I just use the ORO platform so that I created ContactBundle by myself and make it extendable via Discriminator. I have a list of contacts like Student, Teacher, Speaker, … so that I want to use Discriminator. Now my code is OK with my own ContactBundle, no need migration anymore 😀

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.