| @@ 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)) { |
|
| @@ 475-477 (lines=3) @@ | ||
| 472 | public function entityCreate($entity_type, $entity) { |
|
| 473 | // If the bundle field is empty, put the inferred bundle value in it. |
|
| 474 | $bundle_key = \Drupal::entityManager()->getDefinition($entity_type)->getKey('bundle'); |
|
| 475 | if (!isset($entity->$bundle_key) && isset($entity->step_bundle)) { |
|
| 476 | $entity->$bundle_key = $entity->step_bundle; |
|
| 477 | } |
|
| 478 | ||
| 479 | // Throw an exception if a bundle is specified but does not exist. |
|
| 480 | if (isset($entity->$bundle_key) && ($entity->$bundle_key !== NULL)) { |
|