You are here

public function Drupal8::createEntity in Realistic Dummy Content 3.x

Same name and namespace in other branches
  1. 8.2 api/src/Framework/Drupal8.php \Drupal\realistic_dummy_content_api\Framework\Drupal8::createEntity()
  2. 7.2 api/src/Framework/Drupal8.php \Drupal\realistic_dummy_content_api\Framework\Drupal8::createEntity()

Create an entity.

Parameters

array $info: Associative array which can contain (defaults are the first value): entity_type => node|user|... dummy => FALSE|TRUE.

Overrides Framework::createEntity

File

api/src/Framework/Drupal8.php, line 321

Class

Drupal8
Drupal 8-specific code.

Namespace

Drupal\realistic_dummy_content_api\Framework

Code

public function createEntity(array $info = []) {
  if (isset($info['entity_type']) && $info['entity_type'] != 'node') {
    throw new \Exception(__FUNCTION__ . ' unknown entity type.');
  }
  else {
    return $this
      ->createDummyNode();
  }
}