You are here

public static function EckEntity::create in Entity Construction Kit (ECK) 8

Constructs a new entity object, without permanently saving it.

Parameters

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

static The entity object.

Overrides EntityBase::create

1 call to EckEntity::create()
EckEntityTest::createEckEntity in tests/src/Kernel/EckEntityTest.php
Creates ECK entity.

File

src/Entity/EckEntity.php, line 41

Class

EckEntity
Defines the ECK entity.

Namespace

Drupal\eck\Entity

Code

public static function create(array $values = []) {
  $entity_type_manager = \Drupal::entityTypeManager();
  $storage = $entity_type_manager
    ->getStorage($values['entity_type']);
  return $storage
    ->create($values);
}