ssossossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

Forums Forums OroCommerce Persistent class names

This topic contains 2 replies, has 3 voices, and was last updated by  msulima 4 months, 1 week ago.

  • Creator
    Topic
  • #32325

    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
  • #32326

    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.

    #32327

    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)

You must be logged in to reply to this topic.