ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 11 replies, has 4 voices, and was last updated by  hemham914 2 years, 7 months ago.

  • Creator
    Topic
  • #3992

    How I can add a custom field in OroCRMAccountBundle:Account ?
    I want add a field into my personal Bundle (I don’t want modify the OroCRM Bundle, but extends the Entity into my Bundle).

Viewing 11 replies - 1 through 11 (of 11 total)
  • Author
    Replies
  • #4008
    Dima Soroka
    Dima Soroka
    Oro Core

    You can add your fields as extended fields. Please take a look how it is done in Account Bundle.

    #4027

    Yes I’ve read the documentation and I’ve made the migration (new field into the database) but how I can work with this new field?

    I’ve added two fields into orocrm_account but how I can work with them (with getRepository etc) ?

    Thanks.

    #4045

    Vova Soroka
    Oro Core

    You can use extended field as regular fields. For instance if you have added ‘test’ field in Account entity, you can do something like this:
    $account = $doctrine->getRepository('OroCRMAccountBundle:Account')->find($accountId);
    $account->getTest();

    #4083

    I’ve wrote this :

    The error message:

    I don’t know how to make. Thanks.

    #4084

    I’ve changed my code:

    And when I test this = fail.

    Help please ^^ thanks.

    #4085

    Error message :

    #4202

    No ideas?
    Thanks.

    #4214

    Vova Soroka
    Oro Core

    Unfortunately you cannot extend your entity class from Account entity. But if you need to add some additional fields to Account entity just add them in a migration for your bundle, for instance:

    Next, to update the database run oro:migration:load command:

    Also you need to add translations for new fields in Resources/translations/messages.en.yml. In this case:

    After this new fields will be displayed on account view and edit pages automatically.

    #4215
    Dima Soroka
    Dima Soroka
    Oro Core

    @ruizalexandre can you please describe your use case with more details as we would like to understand better your needs. Alternative solution to custom field could be one to one relation.

    #4228

    I’ll try the Vova Soroka’s method, thanks you.

    #6266

    hemham914
    Participant

    I’ve attempted to implement this process in my application like so:

    It seems to work fine when i run oro:migration:load --force --show-queries, however when I update the schema with the oro:entity-extend:update-schema command, I get the following error:

    Any ideas?


    ~Coding my life away~

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

You must be logged in to reply to this topic.