OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – How do I? Questions New Field On Existing Entity Best Practices

This topic contains 9 replies, has 4 voices, and was last updated by  Ale Cerutti 9 years, 9 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
  • #35776

    keganv
    Participant

    Hi there, I need to be able to put a new field called “team” on the user entity. This is easy enough via the UI, however, I’m not seeing any code or migrations being written that would allow me to push that change to a git repo for my team members to pull and update their app with.

    I tried the regular Symfony way of bundle inheritance, however that doesn’t seem to be working either. I saw that Oro has all the forms set up as services and wasn’t sure if that might be why my form type is not overwriting Oro’s?

    What is the best practice when I need these fields to be trackable/pushable to a repo.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Author
    Replies
  • #35777

    Vova Soroka
    Participant

    Hi,
    you can use migrations to add new field. An example you can find in AccountBundle

    #35778

    keganv
    Participant

    Hi Vova, I had already tried this way as well. However, this did not put the new field in the view when editing a user, or on the System/ Entities/ Entity Management/ User page. Could I be missing something?

    #35779

    keganv
    Participant

    I should add that I ran the php app/console oro:migration:load command also. The field never did show up on the view and edit pages.

    #35780

    keganv
    Participant

    I got it to work, it had to do with a core bundle, I did a fresh install and all is working properly now. Thanks!

    #35781

    Ale Cerutti
    Participant

    Hi,
    I pass the same problem, and my solution was to use Migration to extend an Entity. I followed this link http://oroinc.com/orocrm/forums/topic/add-custom-field-into-orocrm-entity and all work fine.
    You can’t see the new fields in the entity that you extends, but they should see on the “Additional” form tab and, in the controller, you can access them just like a normal entity attribute.

    Hope this help! If you need a complete example, just tell me!

    Bye bye

    #35782

    keganv
    Participant

    Now my issue is that I added an “addOptionSet” in my migration. By itself that works fine. However, how can I write my migration so that the options are populated via the migration script? I don’t see any documentation or read me file help on this. I tried “choices”, which would be the natural symfony way, but that throws errors.

    #35783

    Ale Cerutti
    Participant

    I tried the addOptionSet code from OroCRMSalesBundle and the Migrations works fine, but i can’t see any field option neither in the form nor in the data base. I had miss something? I’m learning OroCRM too, and this help me a lot.

    Bye bye

    #35784

    Dima Soroka
    Keymaster

    Hi guys

    We are aware of a few issues related to option sets and planning pretty big refactoring in this area in nearest future. Issues that you mentioned we’ll include in the scope. Please let us know if you find something else.

    Thanks

    #35785

    Ale Cerutti
    Participant

    Thanks Dima, I let you know if I find an issue. Soon, I’ll start a big project with OroCRM and by now, I have to testing and learning it.

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

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

Back to top