1 entity.module entity_create($entity_type, array $values)

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

EntityInterface: A new entity object.

File

core/modules/entity/entity.module, line 630
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);
}