Covering OroCommerce, OroCRM, OroPlatform topics, including community updates and company announcements.

Forums OroCommerce Extend core entities

This topic contains 3 replies, has 3 voices, and was last updated by  jderdziak 1 year, 5 months ago.

  • Creator
  • #31642


    I would like to extend customer entity to add new field “vat”. This field should be editable in backend and visible on grids. I decited to use EntityExtendBundle. I wrote migration script and new field has been appeared on backend. Great, but now I would like to use this field in businness logic in code $customer->getVat(). You warn on documentation:

    It is not recommended to rely on the existence of dynamic fields in your business logic since they can be removed by administrative users.

    What should i do? Mark dynamic field as “is system” (to prevent to delete entity) and create some mock class for intelisense in IDE (how?), or maybe i should use different method to add new fields like overriding entity objects (standard symfony).

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
  • #31643


    Yes, you right. You should mark that field as system, that will prevent deletion of that field from interface.

    In migration please use

    Constant is available in



    I have another problem which is related to extended fields. I want to use extended field (vat) in registration form. If I add new field in form (in this example changed class in vendor, vendor/oro/customer-portal/src/Oro/Bundle/CustomerBundle/Form/Type/FrontendCustomerUserRegistrationType.php), bellow exception will be raised durring generation form:

    Neither the property “vat” nor one of the methods “getVat()”, “vat()”, “isVat()”, “hasVat()”, “__get()” exist and have public access in class “Oro\Bundle\CustomerBundle\Entity\CustomerUser”.

    Object form model is vendor/oro/customer-portal/src/Oro/Bundle/CustomerBundle/Entity/CustomerUser.php which know anything about field vat.

    How to add new field in customer registration form? Is it possible if we use extended fields?

    Thanks for help!



    Extending CustomerUser is not possible at this moment. It will be corrected in one of the future release. Workaround for now would be to create your own entity, and make a relation to CustomerUser.

    You can see example how can it be done in TaxBundle (see CustomerTaxCode and CustomerFormViewListener).

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

You must be logged in to reply to this topic.

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

Yes No
sso for www.magecore.comsso for oroinc.comsso for oroinc.desso for oroinc.frsso for marketplace.orocommerce.comsso for