I don't know if the problem lies with bundle_copy or with paragraphs module.
Seems like bundle_copy tries to find a 'machine_name' property, but paragraphs entities have a 'bundle' property instead.
This results in:

The machine-readable name must contain only lowercase letters, numbers, and underscores.

Posting my quickfix in a patch here for anyone with the same problem

Comments

rv0 created an issue. See original summary.

rv0’s picture

Issue summary: View changes
rv0’s picture

Status: Active » Needs review
StatusFileSize
new778 bytes
jeroen.b’s picture

I think it should use the "bundle" property from hook_entity_info.
Something like this:

$entity_info = entity_get_info($entity_type);
if (isset($entity_info['bundle keys']['bundle'])) {
  $bundle_name = $bundle->{$entity_info['bundle keys']['bundle']};
}
vouza’s picture

I can confirm that since 7.x-2.x-dev I am not able any longer to import paragraph items. Was able to fix it like so:

// Validate a bundle name.
//$bundle_name_validate = $bc_info[$entity_type]['bundle_name_validate'];
$bundle_name = $bundle->bc_entity_type ? $bundle->bc_entity_type : $bundle->machine_name;
interdruper’s picture

Status: Needs review » Reviewed & tested by the community
Related issues: +#2474569: export/import with bundle copy
StatusFileSize
new1.18 KB

#5 fixes the problem for me in 7.x-2.x. Patch for 7.x-2.x attached.

fizk’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new807 bytes

@interdruper Does this work for you?

interdruper’s picture

#6 and #7 seem equivalent to me and both work, because $bundle->bc_entity_type === $entity_type === 'paragraphs_item'... unless some side-effect or error condition is escaping to my knowledge...