| @@ 499-501 (lines=3) @@ | ||
| 496 | $info = entity_get_info($entity_type); |
|
| 497 | // If the bundle field is empty, put the inferred bundle value in it. |
|
| 498 | $bundle_key = $info['entity keys']['bundle']; |
|
| 499 | if (!isset($entity->$bundle_key) && isset($entity->step_bundle)) { |
|
| 500 | $entity->$bundle_key = $entity->step_bundle; |
|
| 501 | } |
|
| 502 | ||
| 503 | // Throw an exception if a bundle is specified but does not exist. |
|
| 504 | if (isset($entity->$bundle_key) && ($entity->$bundle_key !== NULL)) { |
|
| @@ 493-495 (lines=3) @@ | ||
| 490 | public function entityCreate($entity_type, $entity) { |
|
| 491 | // If the bundle field is empty, put the inferred bundle value in it. |
|
| 492 | $bundle_key = \Drupal::entityTypeManager()->getDefinition($entity_type)->getKey('bundle'); |
|
| 493 | if (!isset($entity->$bundle_key) && isset($entity->step_bundle)) { |
|
| 494 | $entity->$bundle_key = $entity->step_bundle; |
|
| 495 | } |
|
| 496 | ||
| 497 | // Throw an exception if a bundle is specified but does not exist. |
|
| 498 | if (isset($entity->$bundle_key) && ($entity->$bundle_key !== NULL)) { |
|