Forums

Covering OroCommerce, OroCRM, OroPlatform topics, including community updates and company announcements.

Forums OroCRM OroCRM – How do I? Questions Dynamic enum with extension

This topic contains 4 replies, has 3 voices, and was last updated by  dawid.zaroda 3 weeks, 2 days ago.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #37529
    mlukaszewicz
    mlukaszewicz
    Participant

    Hello Dawid,

    When you create new enum type you are in fact creating new entity and a relation to it.

    In your case I can suggest 3 possible solutions:

    1) create new enum type and use it. You can add some values during the migration and later on through UI/migrations.
    2) create many-to-one relation from Account to your entity instead of enum
    3) if for some reason you want to create enum and sync it’s values with your entity you can do this using postUpdate/postPersist events on Account add/update your enum field values.

    Please tell me if you have any additional questions.

    Best,
    Martin

    • This reply was modified 3 weeks, 5 days ago by mlukaszewicz mlukaszewicz.
    #37531

    dawid.zaroda
    Participant

    Hello Martin,

    thank you for response. I chose option number 2 and added many-to-one relation. But problem is, that I can not add any additional conditions, like “don’t pick deleted rows”. My code:

    Can you help me with that, please?

    Best regards,
    Dawid

    #37532
    Yevhen Shyshkin
    Yevhen Shyshkin
    Participant

    Hello, Dawid.

    If I understood you correctly you want to restrict list of entities you’d like to see at you entity dropdown. The easiest solution for that is to create custom form type (probably autocomplete) and add your restrictions there. Then you can set your form type to entity field configuration, so application with use it instead of the default form type.

    Here is example of how it can be done:

    Pretty good example of such functionality is available here.

    #37535

    dawid.zaroda
    Participant

    Hello Yevhen,
    thanks for your help – it works.

    Regards,
    Dawid

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

You must be logged in to reply to this topic.

You will be redirected to [title]. Would you like to continue?

Yes No
sso for www.magecore.comsso for oroinc.comsso for oroinc.desso for oroinc.frsso for marketplace.orocommerce.comsso for marketplace.orocrm.com