Score:1

entity_generate process plugin issue with node generation

in flag

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?

Score:1
in flag

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".

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.