OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – How do I? Questions How to enable tag and attachments for BusinessUnit

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

    Sergey
    Participant

    Hi. I need to enable Tags and Attachments for BusinessUnit
    I can do that in ENTITY MANAGEMENT or in console with command

    but when i use entity-config:update

    all my changes desapearing

    It is easy issue for custom entities where I can add annotations

    BusinessUnit is ORO entity ( vendor/Oro/Bundle/OrganizationBundle/Entity/BusinessUnit.php)
    and it is a very bad practice to edit it but I can’t find another.

    Can you recommend some better solution of this problem?

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

    mmiasnikov
    Participant

    Hi, @sergey.stepanchuk!

    Probably the only solution at the moment – use DB migration for this. Please, take a look at example how to set up options in OroCRMTaskBundle https://github.com/oroinc/OroCRMTaskBundle/blob/2.3/Migrations/Schema/v1_2/OroTaskBundle.php#L96-L127.

    #29346

    Sergey
    Participant

    Hi, mmiasnikov. Thanks for your answer.

    I created migration as you proposed.

    After run migration options ‘enable’ were set to ‘true’

    Unfortunately after execute

    changes disappeared

    I found another solution maybe it will be useful for other.
    I modified bundle’s install script to enable Tags and Attachments for BusinessUnit after config:update

    So after every deploy and update with force, Tags and Attachments are always enabled.

    Then I found another bad thing. When we disable Tags (in ‘entity manager’ or after ‘php app/console oro:entity-config:update –force’) all tags that we had set for BusinessUnits disapeared from them.
    I found that Tag’s relation deleted in Tag’s Entity listener – class EntityConfigListener, function postFlush (oro/platform/src/Oro/Bundle/TagBundle/EventListener/EntityConfigListener.php)
    So I decided to overwrite this listener and extend TagBundle

    And add exception for BusinessUnit

    Well, that’s how I achieved my goal

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

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

Back to top