You are here

public static function EntityTestBundleClass::preCreate in Drupal 10

Changes the values of an entity before it is created.

Load defaults for example.

Parameters

\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.

mixed[] $values: An array of values to set, keyed by property name. If the entity type has bundles the bundle key has to be specified.

Overrides EntityTest::preCreate

File

core/modules/system/tests/modules/entity_test_bundle_class/src/Entity/EntityTestBundleClass.php, line 60

Class

EntityTestBundleClass
The bundle class for the bundle_class bundle of the entity_test entity.

Namespace

Drupal\entity_test_bundle_class\Entity

Code

public static function preCreate(EntityStorageInterface $storage, array &$values) {
  parent::preCreate($storage, $values);
  self::$preCreateCount++;
}