OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions Problems when adding relation to custom entity

This topic contains 2 replies, has 1 voice, and was last updated by  mattsches 8 years, 10 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
  • #33861

    mattsches
    Participant

    Hi there,

    I’m using Oro CRM/OroPlatform 1.6 and have a problem creating a manyToMany relation between the User entity and a custom entity (let’s call it Category) – or, to be more precise, after creating a relation.

    Doesn’t matter if I create it by ways of a migration or in the UI – I always end up with an exception when trying to update the entity config or the schema (and even on the login screen).

    Also, it seems like when creating the manyToMany relation, a field oro_user.default_categories_id is added ( – in addition to the mapping table).

    Clearing caches does not help, somehow the $default_categories metadata is always recreated. But I have no idea where it comes from. It’s not to be found in the data field for the respective entity (User) oro_entity_config.

    Any pointers?

    Regards,
    Matthias

    PS: I would prefer to create the relation in a migration, but currently I’m using the UI. Is there any difference between the two?

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

    mattsches
    Participant

    Update: I’ve been narrowing it down to the without_default flag. Question is, where do I set it? Doesn’t seem to be possible in the UI, and it’s not clear to me how to set it in the migration.

    For example, $extendConfig->is('without_default') is never true and consequently defines a $defaultEntity. But how can I make sure there is a without_default property in the extended config? How is a migration supposed to look like that adds a manyToMany relation without a default relation?

    #33863

    mattsches
    Participant

    So it all boils down to the migration. Calling $this->extendExtension->addManyToManyRelation(...) adds the field to the oro_entity_config_field table, but the User configuration in oro_entity_config does not seem to be updated accordingly. The relation information is missing there completely.

    When I try to add categories to a User, they are not saved (although no error occurs).

    How can I make sure the entity config is updated correctly?

    Thx for reading all this, any help would be appreciated :)

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

The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.

Back to top