Inheritance of entities like objects?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hi-ko
    Senior Member
    • May 2015
    • 100

    #1

    Inheritance of entities like objects?

    There is no way to inherit entity definitions, as is possible with object inheritance, is there? I would like to implement contracts that differ greatly by type in their properties and behavior depending on the contract type (e.g., purchase contract, service contract, usage rights) but share a common set on fields to be searched, listed, linked in workflow rules, emails, ...

    The only options I can think of are
    1. one single entity has the sum of all fields, which are shown or hidden depending on the type
    2. The data of the “superclass” is managed in a entity, while the data of the “inheriting” classes is managed in separate entities that have a parent/child relationship.
    3. No "inheritance". Several entity types have all required fields on their own entity. Worflow rules / after save triggers will update an abstract entity to be searched on and linked to.
    Does anyone have a better idea? Maybe someone has already examples how to implement something like a superclass / inherited entity type?
    Last edited by hi-ko; 08-06-2025, 08:11 AM.
  • a.slyzhko
    Senior Member
    • Oct 2023
    • 115

    #2
    You can use additional builder to dynamically add metadata for your needs. Check out documentation and coding example

    Comment

    • hi-ko
      Senior Member
      • May 2015
      • 100

      #3
      Originally posted by a.slyzhko
      You can use additional builder to dynamically add metadata for your needs. Check out documentation and coding example
      Thanks for your feedback. Isn't that the first variant I mentioned with details how to restrict query and access to the fields?
      I'm still not sure which way to go but I guess there is no better way than variant 1 or 3.

      Comment

      • a.slyzhko
        Senior Member
        • Oct 2023
        • 115

        #4
        It’s definitely not about first option, more about third but with inheritance. I meant you can do next:
        1. create all needed entity types (via UI using entity manager)
        2. create additional builder which will populate your “default” metadata for all those entity types + you have a possibility to do it conditionally. This step is mimicking an inheritance.
        3. Continue editing each entity type via Entity Manager, but with their own unique data.

        You will understand the power of additional builder only after using it. Try it and I believe you will not regret it.

        Comment

        Working...