ssossossosso

Forums

Covering OroCommerce topics, B2B eCommerce trends, community updates and company announcements.

This topic contains 1 reply, has 2 voices, and was last updated by  Dmitriy Pasechnik 1 day, 9 hours ago.

  • Creator
    Topic
  • #5112

    Metzler
    Participant

    Hi,

    there are a bunch of db tables that contains php classes e.g.:

    Table: oro_order
    Column: source_entity_class
    Row value: Oro\Bundle\ShoppingListBundle\Entity\ShoppingList

    or:

    Table: oro_attribute_family
    Column: entity_class
    Row value: Oro\Bundle\ProductBundle\Entity\Product

    Can you describe the concept behind the persistence of class names?
    Why should a row need to know which class has to be used for?

    Thanks in advance

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #5271

    Dmitriy Pasechnik
    Participant

    Hi Metzler.
    In case of ‘oro_attribute_family’ table, single row describes basic information about ‘Attribute family’. And we need to somehow save information about which entity this ‘attribute family’ belongs to. So we simply save name of this entity into database.
    There are also a lot of other cases. Most typical one – when we need to create relation between one entity ant a lot of others. In this case we create couple of columns – ‘entity_class’ and ‘record_id’. See ‘oro_search_item’ for example.

    Of course, this is not the only way to implement this kind of relations. We could use some kind of aliases instead of raw class names for entities, or use multiple columns to create relations with different entities, but we choose this method because we wanted to make extension of our code as easy, as possible.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.