Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Alexis94 on
Hello everyone,
I'm using the module migrate source csv to import a csv file.
I took a look at the page https://www.drupal.org/docs/8/modules/migrate-source-csv/using-the-migra... to understand how to use the module.
Here is my csv file:
id,title,body, field_image
1,title 1,some body text 1, image_from_the_web.jpg
2,title 2,some body text 2, image_from_the_web.jpg
3,title 3,some body text 3, image_from_the_web.jpg
And here is my configuration:
id: basuuid
label: Import articles
migration_groups:
- ACME import
source:
plugin: csv
# Full path to the file.
path: '/mypath/to/file/acme_articles.csv'
# Column delimiter. Comma (,) by default.
delimiter: ','
# Field enclosure. Double quotation marks (") by default.
enclosure: '"'
# The number of rows at the beginning which are not data.
header_row_count: 1
keys:
- id
# Here we identify the columns of interest in the source file.
# Each numeric key is the 0-based index of the column.
# For each column, the key below is the field name assigned to
# the data on import, to be used in field mappings below.
# The value is a user-friendly string for display by the
# migration UI.
column_names:
0:
id: 'Unique Id'
1:
title: 'Title'
2:
body: 'Post body'
3:
field_image: 'Image'
process:
title: title
body: body
field_image: field_image
type:
plugin: default_value
default_value: article
destination:
plugin: entity:node
When I want to execute the command drush migrate-import basuuid, i get this error:
Call to a member function getFileUri() on a non-object in /drupal/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
.
I took a look on other topics if I could solve my problem but without success. Someone would have the solution?
Thank you
Comments
I have the feeling that it is
I have the feeling that it is necessary to create an other yml file specific to the images. I took a look on some tutorials but everything is different every time. I'm completely lost ..