/** * Implements hook_ENTITY_TYPE_insert(). */ function {{ machine_name }}_ENTITY_TYPE_insert(Drupal\Core\Entity\EntityInterface $entity) { // Insert the new entity into a fictional table of this type of entity. \Drupal::database()->insert('example_entity') ->fields([ 'id' => $entity->id(), 'created' => REQUEST_TIME, 'updated' => REQUEST_TIME, ]) ->execute(); }