OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums Forums OroCommerce Set enum field for customer in customer user registration form?

This topic contains 3 replies, has 2 voices, and was last updated by Andrey Yatsenko Andrey Yatsenko 1 year ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #40217

    peeush
    Participant

    Hi

    I am trying to figure out the right way of updating a custom multi-select enum field (“Customer Type”) for Customer entity, using the input on Customer User Registration form (Customer User entity also has exactly same custom multi-select enum field, named Customer User Type). Below is my code:

    and services.yml

    Needless to say, using Extend\Entity\EV_Customer_Type is incorrect and I am getting symfony errors not recognising the class.

    Can someone guide me please on how to get this working?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #40259
    Andrey Yatsenko
    Andrey Yatsenko
    Moderator

    HI Peeush,

    In the code, you should always use real entity names instead of the generated from the cache.

    #40261

    peeush
    Participant

    Thanks Andrey, but not sure what’s the “real” entity that I can use here – I used extendExtension->addEnumField() function in my migration class to add this custom field (named “Type” – with multi_select option set to true) and hence, don’t have a real entity class that I can use (or know what’s the right function to call).

    All’s good in the code above but for line #39-41 where I am not able to set the values for this enum field – any suggestions?

    Thanks

    #40267
    Andrey Yatsenko
    Andrey Yatsenko
    Moderator

    When working with enums you can use “ExtendHelper::buildEnumValueClassName($enumCode)” method to get the real class name.

    Also, it looks that you call the enum class method setName in a wrong way, as it’s not static.

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

The forum ‘OroCommerce’ is closed to new topics and replies.

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

Yes No