0

I have created a custom entity type called custom_enitity and new bundle scores, using UI. Also got custom form display called score to add score via custom route. I keep getting the following error message.

Drupal\Core\Entity\EntityStorageException: Missing bundle for entity type custom_entity in Drupal\Core\Entity\ContentEntityStorageBase->doCreate() (line 108 of core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php)

The content of my_module.routing.yml is the following.

custom_entity.score:
  path: '/entry/{entry_id}/score'
  defaults:
    _entity_form: custom_entity.score
  requirements:
    _role: 'administrator+judge'
  options:
    parameters:
      entry:
        type: entity:entry

The folder hierarchy is the following: custom_entity/src/Form/CustomEntityScoreForm.php. The class in the file is CustomEntityScoreForm which extends ContentEntityForm.

How do I add a bundle (scores) to the routing file? What am I missing?

1
  • Don't think this is the issue, more likely you are missing an entity key in the custom entity class annotations: @ContentEntityType(entity_keys = {"bundle" = "bundle"}) – 4k4 May 10 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.