OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – Programming Questions Add custom Field into OroCRM Entity?

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

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

  • Creator
  • #24757

    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
  • #24758

    Dima Soroka

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


    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) ?



    Vova Soroka

    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);


    I’ve wrote this :

    The error message:

    I don’t know how to make. Thanks.


    I’ve changed my code:

    And when I test this = fail.

    Help please ^^ thanks.


    Error message :


    No ideas?


    Vova Soroka

    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.


    Dima Soroka

    @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.


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



    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)

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

Back to top

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

Yes No

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

Yes No