| @@ 492-494 (lines=3) @@ | ||
| 489 | $info = entity_get_info($entity_type); |
|
| 490 | // If the bundle field is empty, put the inferred bundle value in it. |
|
| 491 | $bundle_key = $info['entity keys']['bundle']; |
|
| 492 | if (!isset($entity->$bundle_key) && isset($entity->step_bundle)) { |
|
| 493 | $entity->$bundle_key = $entity->step_bundle; |
|
| 494 | } |
|
| 495 | ||
| 496 | // Throw an exception if a bundle is specified but does not exist. |
|
| 497 | if (isset($entity->$bundle_key) && ($entity->$bundle_key !== NULL)) { |
|
| @@ 464-466 (lines=3) @@ | ||
| 461 | public function entityCreate($entity_type, $entity) { |
|
| 462 | // If the bundle field is empty, put the inferred bundle value in it. |
|
| 463 | $bundle_key = \Drupal::entityManager()->getDefinition($entity_type)->getKey('bundle'); |
|
| 464 | if (!isset($entity->$bundle_key) && isset($entity->step_bundle)) { |
|
| 465 | $entity->$bundle_key = $entity->step_bundle; |
|
| 466 | } |
|
| 467 | ||
| 468 | // Throw an exception if a bundle is specified but does not exist. |
|
| 469 | if (isset($entity->$bundle_key) && ($entity->$bundle_key !== NULL)) { |
|