public static function Update::preCreate in Update helper 8
Same name and namespace in other branches
- 2.x modules/update_helper_checklist/src/Entity/Update.php \Drupal\update_helper_checklist\Entity\Update::preCreate()
When a new entity instance is added, set the user_id entity reference to the current user as the creator of the instance.
Overrides EntityBase::preCreate
File
- modules/
update_helper_checklist/ src/ Entity/ Update.php, line 47
Class
- Update
- Defines the Contact entity.
Namespace
Drupal\update_helper_checklist\EntityCode
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += [
'user_id' => \Drupal::currentUser()
->id(),
];
}