src/Drupal/Driver/Cores/Drupal7.php 1 location
|
@@ 497-502 (lines=6) @@
|
| 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)) { |
| 498 |
|
$bundles = $info['bundles']; |
| 499 |
|
if (!in_array($entity->$bundle_key, array_keys($bundles))) { |
| 500 |
|
throw new \Exception("Cannot create entity because provided bundle {$entity->$bundle_key} does not exist."); |
| 501 |
|
} |
| 502 |
|
} |
| 503 |
|
if (empty($entity_type)) { |
| 504 |
|
throw new \Exception("You must specify an entity type to create an entity."); |
| 505 |
|
} |
src/Drupal/Driver/Cores/Drupal8.php 1 location
|
@@ 480-485 (lines=6) @@
|
| 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)) { |
| 481 |
|
$bundles = \Drupal::entityManager()->getBundleInfo($entity_type); |
| 482 |
|
if (!in_array($entity->$bundle_key, array_keys($bundles))) { |
| 483 |
|
throw new \Exception("Cannot create entity because provided bundle '$entity->$bundle_key' does not exist."); |
| 484 |
|
} |
| 485 |
|
} |
| 486 |
|
if (empty($entity_type)) { |
| 487 |
|
throw new \Exception("You must specify an entity type to create an entity."); |
| 488 |
|
} |