function entity_create

Constructs a new entity object, without permanently saving it.

Parameters

$entity_type: The type of the entity.

$values: An array of values to set, keyed by property name. If the entity type has bundles the bundle key has to be specified.

Return value

Drupal\Core\Entity\EntityInterface A new entity object.

136 calls to entity_create()

File

drupal/core/includes/entity.inc, line 266
Entity API for handling entities like nodes or users.

Code

function entity_create($entity_type, array $values) {
  return entity_get_controller($entity_type)
    ->create($values);
}