OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – How do I? Questions Drop one-to-many relation (attachementExtentsion)

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

    bosumflici
    Participant

    Hi,

    I’d like to know how can i drop/delete an attachment Association created through migrations like this:

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #36391

    Mike Kudelya
    Participant

    Hi

    If you want to delete ‘Add Attachment’ option in ‘More Actions’ drop-down try to change this “System -> Entity Management -> [Entity] -> [Edit] -> Enable Attachments -> No”.

    #36392

    bosumflici
    Participant

    Sorry for late reply.

    No that’s not what i meant. I create an attachment relation through migration. Later i need to drop that relation. How can i do that?

    #36393

    Mike Kudelya
    Participant

    Hi

    To remove the relation, you should first find the ID of the ‘Oro\Bundle\AttachmentBundle\Entity\Attachment’ entity in the oro_entity_config table and delete your entity field (cb_newage_panel_view) from oro_entity_config_field filtering by “where entity_id = ID”. Afterwards, please delete your entity from the oro_attachment table. Also, I have created a small hack for the entity config (oro_entity_config::data). You should modify the config of the ‘Oro\Bundle\AttachmentBundle\Entity\Attachment’ entity and delete the relation. Put the column’s data in the $str variable, recognize the relation name (in my case it is manyToOne|Oro\Bundle\AttachmentBundle\Entity\Attachment|Extend\Entity\ContactData|contact_data_ed9890f2) and unset it. Once you have done that, put it back into the oro_entity_config::data field.
    I suggest you run this code in any controller/service of your project, otherwise the unserialize function will give the wrong result.

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

The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.

Back to top