1

I want to use use entity_generate plugin to create a node for each row of source I'm migrating. I'm getting 'title' source field and want to create a node in some my_content_type, with that title. My migration looks like:

  # Field to populate
  my_content_type:

    plugin: entity_generate
    source: title
    entity_type: node
    bundle: my_content_type
    value_key: title
    bundle_key: nid
    values:
      title: title

So, I don't have field referencing that node I'm creating - I just want node to be created as a "side effect". But when I run migration I get the error:

In ContentEntityStorageBase.php line 125:
Missing bundle for entity type node

I basically tried to adjust example for tags from here: https://www.drupal.org/docs/8/api/migrate-api/migrate-process-plugins/contrib-process-plugin-entity_generate

..but something isn't right there. Why it's complaining about missing "bundle" parameter, when I provided it?

1 Answer 1

2

Got help from @danflanagan8 on drupal slack channel. So, annotation for tags looks like:

*   entity_keys = {
*     "id" = "tid",
*     "revision" = "revision_id",
*     "bundle" = "vid",
*     "label" = "name",
*     "langcode" = "langcode",
*     "uuid" = "uuid",
*     "published" = "status",
*   },

and for nodes it's like this:

*   entity_keys = {
*     "id" = "nid",
*     "revision" = "vid",
*     "bundle" = "type",
*     "label" = "title",
*     "langcode" = "langcode",
*     "uuid" = "uuid",
*     "status" = "status",
*     "published" = "status",
*     "uid" = "uid",
*     "owner" = "uid",
*   },

So bundle for taxonomy terms is "vid" and for nodes is "type". In example migration file for taxonomy term bundle_key field has value "vid" and by following that logic for node bundle_key should have value "type".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.