OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – How do I? Questions Adding an address directly to the account

This topic contains 8 replies, has 3 voices, and was last updated by  acaliman 6 years, 5 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
  • #36520

    keelen
    Participant

    I am trying to create a link between addresses and acounts on or CRM 2.
    So I added 2 fields with a migration, “shipping address” and “billing address”.

    I also added the following code in account/update.html.twig

    I also added the following code in form/type/accountType.php

    I can now see an “address” block in the edit view, and I twice get a form to enter the address in: perfect!
    The only problem is, that when I save I get the error I get the message “This value should contain only numbers.”
    I assume I did something wrong with my migration and should have used a different type than “integer”, but I do not know what.
    Can somebody please help me?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Author
    Replies
  • #36521

    Nikita Makarov
    Participant

    Greetings keelen.

    I assume you forgot to add foreign-keys for your fields, for example

    As example can be used following code

    #36522

    keelen
    Participant

    Hey, thank you for your response.

    I did add those foreign keys in my migration like you can see in my code snippet above. I have:

    #36523

    Nikita Makarov
    Participant

    Could you please provide a full migration source code?
    Also please let me know how you apply migrations?
    Or you reinstall application each time?

    And please specify the version of CRM application you are using

    #36524

    keelen
    Participant

    This is my version installed:

    oro/platform 2.4.4
    oro/crm 2.4.4 (enterprise version)

    I run migrations with the command:
    php app/console oro:migration:load –force –timeout=0

    I do NOT reinstall the application each time, just run the migration.
    I also see that the migration succeeded in creating the 2 new fields in the account table – no problem there.

    My full migration script:

    #36525

    keelen
    Participant

    Do I maybe need to add something to a the Account entity like:

    I see that in an old version of Oro CRM (februari 2014) there used to be a relation between address and account, but a later version removed that link. See commit https://github.com/oroinc/crm/blob/2d9e3a52cf7f1cbf22d400004ea776ce44777429/src/OroCRM/Bundle/AccountBundle/Entity/Account.php

    In that commit there is a relation inside the docrine entity, like i linked above. Should I explore this direction, or should I only add relations with Migrations?

    #36526

    Nikita Makarov
    Participant

    I assume that maybe should be used proper field assignment

    but I’m checking it right now

    #36527

    keelen
    Participant

    Hey, I tried to ad two relations but that didn’t work either – it continued to give the error “This value should contain only numbers.”

    Should I maybe open a ticket with the enterprise ticketing system?

    #36528

    acaliman
    Participant

    Hi keelen,

    Yes, if you use the enterprise edition please open a new ticket on http://support.orocommerce.com for getting support.

    Adrian

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

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

Back to top