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

Constructs a new entity object, without permanently saving it.


$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.


core/modules/entity/entity.module, line 630
Entity API for handling entities like nodes or users.


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