I am migrating a field in a node to a paragraph. I am trying to only create the paragraphs where the field has values. That field is an entity reference to another node.
source:
plugin: d7_node
node_type: my_node
process:
target_id:
-
plugin: get
source: node_er_field/0/target_id
parent_id:
-
plugin: get
source: nid
parent_type:
-
plugin: default_value
default_value: node
er_paragraph_field:
-
plugin: skip_on_empty
method: row
source: '@target_id'
message: 'node skipped'
-
plugin: get
source: node_er_field
destination:
plugin: 'entity_reference_revisions:paragraph'
default_bundle: paragraph_er
migration_dependencies: null
When I run the migration, I get a strange reported result though. Of the first two nodes, one has something in the field, and one doesn't. drush mim group_paragraph_field_node --limit=2 Processed 3 items (2 created, 0 updated, 0 failed, 1 ignored)
When I look at messages. The skip_on_empty message appears. But the row that it supposedly skipped is still created. I can't for the life of me understand why this is happening. The row method is being fired. I've tried every permutation I can think of in terms of doing the skip_on_empty, within the same pipeline or like this one. With the target id or just with the field as is. I've tried another custom plugin skip_on_empty_array. Either its 2 created and 0 or 1 ignored, but I always get 2 paragraphs out of it.
I've gotten skip_on_empty to work in other contexts. I don't understand why it is not working here. Had a hard time finding a similar example as well.
Any thoughts?