\Drupal\Core\Entity\ContentEntityStorageBase::createWithSampleValues() does not handle language or bundles correctly

Created on 9 October 2017, about 7 years ago
Updated 26 October 2023, about 1 year ago

Problem/Motivation

The 'default_language' key must be set to TRUE, tests will fail if it is randomly set to FALSE.

Additionally, some entities support bundles but do not require them for ::create() to be called.
For example, MenuLinkContent::preCreate() adds in a default bundle.

Finally, not all implementations of \Drupal\Core\Field\FieldItemInterface::generateSampleValue() return values, and they should not overwrite default values.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
EntityΒ  β†’

Last updated about 12 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States tim.plunkett Philadelphia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡΅πŸ‡±Poland Patryk Padus

    Drupal 9.x give issue:
    Drupal\Core\Entity\EntityStorageException: No entity bundle was specified in Drupal\Core\Entity\ContentEntityStorageBase->createWithSampleValues() (line 230 w .../public_html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php).

    If bundle isn't exist then get error. Bundle removed in Commerce when attribute removed from list but not from LayoutBuilder

  • πŸ‡΅πŸ‡±Poland Patryk Padus

    Path not apply on branch 9.x (latest I test is 9.5.1)

Production build 0.71.5 2024