Problem/Motivation

During my migration while using the entity lookup plugin the content is automatically created and I am unable to stop it from building the content and making the reference. Example: We are importing a ton of user supplied data that might have references to unapproved content that I would like to fail upon attempting to import, rather than clean out of the site afterward

Proposed resolution

Allow for a flag to force an exception if the migration is not meant to create and reference the content.

Original report by generalconsensus

Comments

generalconsensus created an issue. See original summary.

mikeryan’s picture

Component: API » Plugins
Status: Active » Postponed (maintainer needs more info)

Could you share the .yml for the migration which is using the entity_lookup process plugin? There is no code within that plugin to create entities, so it's hard to see where the entities you're seeing are coming from (unless you're chaining with a migration process plugin, which will create stubs unless you set no_stub: true).

heddn’s picture

There's no code in lookup that will generate. Can you provide an example?

mikeryan’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
rob.barnett’s picture

I think this is related. I'm using entity_generate which extends EntityLookup. Entities are still getting created in my migration even though they already exist.

Here is the relevant code from my migrate_plus yml file

process:
  product:
    -
      plugin: entity_generate
      source: product
      entity_type: taxonomy_term
      bundle_key: vid
      bundle: product
      value_key: name

When I run drush mi with --update the entity will get created even though it already exists. Am I coding this incorrectly?
The query method in EntityLookup returns NULL because $results is empty on the query.

rob.barnett’s picture

Status: Closed (cannot reproduce) » Active
rob.barnett’s picture

rob.barnett’s picture

Status: Active » Closed (cannot reproduce)

I figured out my own problem. EntityLookup is working as intended for me. I had some logic being called in a transform method for a custom plugin that was interfering.