OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions Add country field to entity

This topic contains 2 replies, has 3 voices, and was last updated by  Ivan Klymenko 8 years, 4 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
  • #33553

    Pavel Levin
    Participant

    Hello guys!
    I tried to add field with country name to Contact entity, but have problem. I dont want create my dictionary for country and want use oro_dictionary_country. (I know about addressBundle, but i need only one country field).

    1. With Migration
    $this->extendExtension->addManyToOneRelation(
    $schema,
    'orocrm_contact',
    'country',
    'oro_dictionary_country',
    'iso2_code',
    ['extend' => ['without_default' => true, 'is_extend' => true, 'owner' => ExtendScope::OWNER_CUSTOM]]
    );

    when i execute app/console oro:migration:load –force, i have got error:
    [Doctrine\DBAL\Schema\SchemaException]
    The target column name must be "id". Relation column: "orocrm_contact::country_id". Target column name: "iso2_code".

    2. With Entity Manager
    Entity Managament->Contact->Create Field->Name: Country, Type: ManyToOne, Target Entity: OroAddressBundle:Country, Target Field: iso2_code->Save and Close->Update Schema

    After this, i found error in app/logs/dev.log:
    [2014-11-13 14:16:18] app.ERROR:

    [Doctrine\ORM\ORMException]
    Column name `id` referenced for relation from OroCRM\Bundle\ContactBundle\Entity\Contact towards Oro\Bundle\AddressBundle\Entity\Country does not exist.

    [] []
    [2014-11-13 14:16:18] app.ERROR: oro:entity-extend:update-schema [--dry-run] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-s|--shell] [--process-isolation] [-e|--env="..."] [--no-debug] [--jms-job-id="..."] [--current-user="..."] [--current-organization="..."] [--disabled-listeners="..."] command

    Then when i open any contact detail page i have error:
    SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.country_id' in 'field list'

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #33554

    Skun-ky
    Participant

    Hi!
    I have the same problem right now.
    Did you find the solution ?
    Thank you !

    #33555

    Ivan Klymenko
    Spectator

    Hello guys, thank you for the reported issue!
    We had included it into queue and will provide a fix in one of the the following releases.

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

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

Back to top