OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – Programming Questions Get/set method for extend entity

This topic contains 5 replies, has 2 voices, and was last updated by  gmustiere 6 years ago.

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

  • Creator
    Topic
  • #25546

    gmustiere
    Participant

    Hello,

    OroCrm 2.6

    I extended the oro_contact entity with an enum type field following this guide (https://github.com/oroinc/platform/tree/master/src/Oro/Bundle/EntityExtendBundle#add-option-set-field), the migration and data generation happens correctly during installation, however the class generated with the cache does not provide me with a GET/SET method. Have I forgotten an option to give o my migration scheme ?

    Migration :

    Load data :

    EV_class :

    Business logic :

    Thank you for your help

    Br.

    Gabriel

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #25547

    vsoroka
    Moderator

    Hello @gmustiere,

    the generated class does not need own getters and setters, because it extends Oro\Bundle\EntityExtendBundle\Entity\AbstractEnumValue and all getters and setters are there.

    #25548

    gmustiere
    Participant

    Thank you for the answer, I have another question related to this.
    In my business logic, I want to manually feed my attribute which is therefore an enum, but having no real entity or repository, how can I give it? Do I have to create a mapper entity with the table generated by my migration shcema with a model and a repo, I’m a bit confused.

    Thank you for your help

    Br.

    Gabriel

    #25549

    vsoroka
    Moderator

    Hello @gmustiere,

    You can use ExtendHelper::buildEnumValueClassName method to get an enum entity class name.
    An example you can find in EnumExtension::getEnumValues

    #25550

    gmustiere
    Participant

    Hello and sorry for the delay, but I don’t see how I’m going to get out and get enough to recover an entity with the example you gave me.

    The helper allows me to get an “Extend\Entity\EV_ValiationState” classname but I don’t know what to do with this string.

    My goal is to have access to the repository of this entity (Enum), automatically managed by oro, in order to make a findOneBy().

    Thank you a lot.

    #25551

    gmustiere
    Participant

    Okay, I just realized how stupid I am. Sorry and thanks for the info.

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

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

Back to top