src/Drupal/Driver/Cores/Drupal8.php 1 location
|
@@ 487-492 (lines=6) @@
|
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)) { |
488 |
|
$bundles = \Drupal::entityManager()->getBundleInfo($entity_type); |
489 |
|
if (!in_array($entity->$bundle_key, array_keys($bundles))) { |
490 |
|
throw new \Exception("Cannot create entity because provided bundle '$entity->$bundle_key' does not exist."); |
491 |
|
} |
492 |
|
} |
493 |
|
if (empty($entity_type)) { |
494 |
|
throw new \Exception("You must specify an entity type to create an entity."); |
495 |
|
} |
src/Drupal/Driver/Cores/Drupal7.php 1 location
|
@@ 504-509 (lines=6) @@
|
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)) { |
505 |
|
$bundles = $info['bundles']; |
506 |
|
if (!in_array($entity->$bundle_key, array_keys($bundles))) { |
507 |
|
throw new \Exception("Cannot create entity because provided bundle {$entity->$bundle_key} does not exist."); |
508 |
|
} |
509 |
|
} |
510 |
|
if (empty($entity_type)) { |
511 |
|
throw new \Exception("You must specify an entity type to create an entity."); |
512 |
|
} |