8.3.x Entity.php public static Entity::preCreate(EntityStorageInterface $storage, array &$values)
8.0.x Entity.php public static Entity::preCreate(EntityStorageInterface $storage, array &$values)
8.1.x Entity.php public static Entity::preCreate(EntityStorageInterface $storage, array &$values)
8.2.x Entity.php public static Entity::preCreate(EntityStorageInterface $storage, array &$values)
8.4.x Entity.php public static Entity::preCreate(EntityStorageInterface $storage, array &$values)

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 EntityInterface::preCreate

2 calls to Entity::preCreate()
EntityTest::preCreate in core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php
Changes the values of an entity before it is created.
View::preCreate in core/modules/views/src/Entity/View.php
Changes the values of an entity before it is created.
6 methods override Entity::preCreate()
Comment::preCreate in core/modules/comment/src/Entity/Comment.php
Changes the values of an entity before it is created.
EntityTest::preCreate in core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php
Changes the values of an entity before it is created.
Feed::preCreate in core/modules/aggregator/src/Entity/Feed.php
Changes the values of an entity before it is created.
File::preCreate in core/modules/file/src/Entity/File.php
Changes the values of an entity before it is created.
MenuLinkContent::preCreate in core/modules/menu_link_content/src/Entity/MenuLinkContent.php
Changes the values of an entity before it is created.

... See full list

File

core/lib/Drupal/Core/Entity/Entity.php, line 423

Class

Entity
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

public static function preCreate(EntityStorageInterface $storage, array &$values) {
}