I've updated this change record page today: https://drupal.org/node/2196275. It describes that hook_entity_type_build() should be used to add definitions, not the alter hook.

/**
 * Implements hook_entity_type_build().
 */
function node_clone_entity_type_build($entity_types) {
  /** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */

  // Add a form controller for clone operations.
  $classes = $entity_types['node']->getControllerClasses();
  $form_classes = $classes['form'] + array('clone' => 'Drupal\node_clone\NodeCloneFormController');
  $entity_types['node']->setControllerClass('form', $form_classes);
}

This is how I added an entity clone form controller.

node_clone.clone:
  path: 'node/{node}/clone'
  defaults:
    _entity_form: 'node.clone'
  requirements:
    _permission: 'node clone node'

And this is how it is used in node_clone.routing.yml.

Comments

franskuipers’s picture

Agreed.

In \Drupal\Core\Entity\EntityTypeInterface i find this documentation:

/**
 * Provides an interface for an entity type and its metadata.
 *
 * Additional information can be provided by modules: hook_entity_type_build() can be
 * implemented to define new properties, while hook_entity_type_alter() can be
 * implemented to alter existing data and fill-in defaults. Module-specific
 * properties should be documented in the hook implementations defining them.
 */

Apparently hook_entity_type_alter() is only to alter existing properties?