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