You are here

public function RealisticDummyContentRecipe::newEntities in Realistic Dummy Content 7.2

Same name and namespace in other branches
  1. 8.2 api/src/includes/RealisticDummyContentRecipe.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentRecipe::newEntities()
  2. 3.x api/src/includes/RealisticDummyContentRecipe.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentRecipe::newEntities()

Create new entities.

File

api/src/includes/RealisticDummyContentRecipe.php, line 110

Class

RealisticDummyContentRecipe
Abstract base "recipe" class.

Namespace

Drupal\realistic_dummy_content_api\includes

Code

public function newEntities($type, $bundle, $count, $more = array()) {
  self::startTime(array(
    $type,
    $bundle,
    $count,
  ));
  if ($generator = self::getGenerator($type, $bundle, $count, $more)) {
    $generator
      ->generate();
  }
  else {
    self::$log
      ->error(t('Could not find a generator for @type @bundle.', array(
      '@type' => $type,
      '@bundle' => $bundle,
    )));
  }
  $time = self::stopTime(array(
    $type,
    $bundle,
    $count,
  ));
  self::$log
    ->log(t('@type @bundle: @n created in @time milliseconds', array(
    '@type' => $type,
    '@bundle' => $bundle,
    '@n' => $count,
    '@time' => $time,
  )));
}