- if ($entity_type_definition->hasKey('bundle') && $entity_type_definition->isSubclassOf(FieldableEntityInterface::class)) {
- // Get an array containing the bundle only. This also remove the bundle
- // key from the $data array.
- $bundle_data = $this->extractBundleData($data, $entity_type_definition);
+ if ($entity_type_definition->entityClassImplements(FieldableEntityInterface::class)) {
+ // Extract bundle data to pass into entity creation if the entity type uses
+ // bundles.
+ if ($entity_type_definition->hasKey('bundle')) {
+ // Get an array containing the bundle only. This also remove the bundle
+ // key from the $data array.
+ $create_params = $this->extractBundleData($data, $entity_type_definition);
+ }
+ else {
+ $create_params = [];
+ }