Override entity form handler I'm trying to alter an entity form handler. The method EntityType::setHandlerClass() allows for the 'form' handler to be set, but this value is an array, and I only want to override a single item of the array.

The entity handlers definition:

handlers = {
    "storage" = "Drupal\user\UserStorage",
    "storage_schema" = "Drupal\user\UserStorageSchema",
    "access" = "Drupal\user\UserAccessControlHandler",
    "list_builder" = "Drupal\user\UserListBuilder",
    "views_data" = "Drupal\user\UserViewsData",
    "route_provider" = {
      "html" = "Drupal\user\Entity\UserRouteProvider",
    },
    "form" = {
      "default" = "Drupal\user\ProfileForm",
      "cancel" = "Drupal\user\Form\UserCancelForm",
      "register" = "Drupal\user\RegisterForm"
    },
    "translation" = "Drupal\user\ProfileTranslationHandler"
  }


I'm trying to figure out how to override the form.register handler, but as the first argument to setEntityHandler() is a string, I cannot figure out how to set a nested value.
I have found the solution. Instead of using EntityType::setHandlerClass(), use EntityType::setFormClass().