entity_create
function entity_create
entity_create($entity_type, array $values = array())
Constructs a new entity object, without permanently saving it.
\Drupal::entityTypeManager()->getStorage($entity_type)->create($values);
Parameters
string $entity_type: The type of the entity.
array $values: (optional) 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.
Deprecated
in 登录查看完整内容