OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums 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 7 years, 6 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #36321

    thinh2010
    Participant

    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?
    Thanks,

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

    Mike Kudelya
    Participant

    Hi,

    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:

    #36323

    thinh2010
    Participant

    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 :D

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

The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.

Back to top