public static function EntityTest::preCreate in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php \Drupal\entity_test\Entity\EntityTest::preCreate()
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 Entity::preCreate
File
- core/
modules/ system/ tests/ modules/ entity_test/ src/ Entity/ EntityTest.php, line 61 - Contains \Drupal\entity_test\Entity\EntityTest.
Class
- EntityTest
- Defines the test entity class.
Namespace
Drupal\entity_test\EntityCode
public static function preCreate(EntityStorageInterface $storage, array &$values) {
parent::preCreate($storage, $values);
if (empty($values['type'])) {
$values['type'] = $storage
->getEntityTypeId();
}
}