hi there
I'm trying migrate objects from an external database
into (rooms) Enities in drupal 7
by using MigrateDestinationEntityAPI
But In the migarte_ui
I don't get access to the fields of that destination entity
admin / content / migrate / UARoomsMig

class UARoomsMig extends Migration {
public function __construct() {
parent::__construct();
ini_set('auto_detect_line_endings', TRUE);
$query = Database::getConnection('default', 'for_migration')
->select( '_immo_objekte', 'io')
->fields('io', array('obj_id','titel'));
$this->source = new MigrateSourceSQL($query, array(), NULL,
array('map_joinable' => FALSE));
$this->destination = new MigrateDestinationEntityAPI('rooms_unit', 'rooms_unit');
// Create a map object for tracking the relationships between source rows
$this->map = new MigrateSQLMap($this->machineName,
array(
'obj_id' => array('type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
)
),
MigrateDestinationEntityAPI::getKeySchema('rooms_unit', 'rooms_unit')
);
$this->addFieldMapping('name', 'titel');
$this->addFieldMapping('type')->defaultValue("apartment");
$this->addFieldMapping('base_price')->defaultValue(100);
}
}
Thanks in advanced!
Comments
Comment #1
sunset_bill commented+1
I'm running into exactly the same thing trying to migrate a D6 CCK content type into a D7 entity.
Comment #2
sunset_bill commentedFound my answer. It's because of this code in the fields() method of entity_api.inc in the migrate_extras module:
If a field in your target entity doesn't have a setter callback specified, that field doesn't get picked up and therefore won't show in your destination fields.
The fix is to implement hook_entity_property_info_alter() in your entity's .module file. So, for my problem above, it looks like
When I did that, my destination fields showed up and my migration worked.
Comment #3
sunset_bill commented