OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums Forums OroCommerce Persistent class names

This topic contains 2 replies, has 3 voices, and was last updated by  msulima 6 years, 7 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
  • #31816

    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 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #31817

    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.

    #31818

    msulima
    Moderator

    Hi, Metzler.

    Please tell if previous answer didn’t provide enough information to solve your issue.


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

The forum ‘OroCommerce’ is closed to new topics and replies.

Back to top