Closed (fixed)
Project:
Migrate
Version:
7.x-2.3
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
24 May 2012 at 09:16 UTC
Updated:
24 May 2012 at 13:48 UTC
Jump to comment: Most recent file
Hi,
I am developing a complex migration, and the firts problem that i have is that in a TermMigration, my custom fields are not being saved, seems that this kind of fields are not using the language neutral array structure in the term generated object.
Here is my code, what is wrong?
for example, this line is not working: $this->addFieldMapping('field_autor_datos_biograficos', 'BIO_AUTOR1');
$this->map = new MigrateSQLMap($this->machineName,
array(
'ID_AUTOR1' => array('type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'description' => 'Identificador de autor',
)
),
MigrateDestinationTerm::getKeySchema()
);
$query = db_select('OBRAS');
$query->distinct();
$query->addField('OBRAS', 'ID_AUTOR1');
$query->addField('OBRAS', 'NOM_AUTOR1');
$query->addField('OBRAS', 'BIO_AUTOR1');
$query->addField('OBRAS', 'BIO_AUTOR1_ENG');
$query->condition('ID_AUTOR1', "", '!=');
$query->orderBy('ID_AUTOR1', 'ASC');
// Create a MigrateSource object, which manages retrieving the input data.
$this->source = new MigrateSourceSQL($query);
//$term_options = MigrateDestinationNode::options($language, $text_format);
$this->destination = new MigrateDestinationTerm('Obra_Autor');
$this->addFieldMapping('name', 'NOM_AUTOR1');
$this->addFieldMapping('field_autor_id_simars', 'ID_AUTOR1');
$this->addFieldMapping('field_autor_datos_biograficos', 'BIO_AUTOR1');
Best!
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | warning in migrate.png | 49.3 KB | david.gil |
Comments
Comment #1
mikeryanYou're using a Drupal version before 7.14, aren't you? See #1171866: Enforced fetching of fields/columns in lowercase breaks third-party integration - until 7.14, the database API automatically lower-cased field names, so you have to specify your mappings using lowercase.
Comment #2
david.gil commentedHi Mike,
no i am using 7.14, and also i also try to lower case all, but still not working,
i see this warning (screenshot) in migrate ui that must be related, but not sure what to do.
best!
Comment #3
mikeryanOK, since you are on 7.14, then your source field names must match the case that's in the source database.
The machine name of your vocabulary is precisely Obra_Autor, correct (it's not lower-case in Drupal)? What the warnings are saying is that you do not have fields named field_autor_id_simars and field_autor_datos_biograficos on that vocabulary.
Comment #4
david.gil commentedHi Mike,
you are rigtht the problem is with the taxonomy name, i was using the display name not the machine name, both are the same except in case. So some fields work and others not.
When i write it well all is working, no matter the case of fields in the DB, i write it in lower case in code and in upper in DB.
I close this, thanks a lot!!!
Best
David