This topic contains 2 replies, has 3 voices, and was last updated by Ivan Klymenko 7 years, 9 months ago.
-
Topic
-
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 SchemaAfter 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'
The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.