function EntityTestUpdate::preCreate

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/entity_test_update/src/Entity/EntityTestUpdate.php \Drupal\entity_test_update\Entity\EntityTestUpdate::preCreate()
  2. 8.9.x core/modules/system/tests/modules/entity_test_update/src/Entity/EntityTestUpdate.php \Drupal\entity_test_update\Entity\EntityTestUpdate::preCreate()
  3. 10 core/modules/system/tests/modules/entity_test_update/src/Entity/EntityTestUpdate.php \Drupal\entity_test_update\Entity\EntityTestUpdate::preCreate()

Overrides EntityBase::preCreate

File

core/modules/system/tests/modules/entity_test_update/src/Entity/EntityTestUpdate.php, line 43

Class

EntityTestUpdate
Defines the test entity class for testing definition and schema updates.

Namespace

Drupal\entity_test_update\Entity

Code

public static function preCreate(EntityStorageInterface $storage, array &$values) {
    parent::preCreate($storage, $values);
    if (empty($values['type'])) {
        $values['type'] = $storage->getEntityTypeId();
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.