Hello,
I'm getting an error message when perfoming update.php on version 8.9.0. The views_post_update_field_names_for_multivalue_fields
call fails, because my Entity does not implement Drupal\core\Entity\FieldableEntityInterface
... (see screenshot).
It's not mandatory that an entity provides fields. I believe I have seen even a tag boolean fieldable tag that can be set in the @EntityType section. Anyway, in my case I only use values each matching to fields in the database.
As example, the code for one my entities looks like below:
/**
* @EntityType(
* id = "dimension",
* label = @Translation("Dimension"),
* handlers = {
* "storage" = "Drupal\custom_base\Entity\Storage\DimensionStorage",
* "views_data" = "Drupal\custom_base\Entity\Views\DimensionViewsData",
* "form" = {
* "default" = "Drupal\custom_base\Form\DimensionForm",
* "delete" = "Drupal\custom_base\Form\EntityDeleteForm",
* },
* },
* entity_keys = {
* "id" = "id",
* "uuid" = "uuid",
* "label" = "title"
* },
* )
*/
class DimensionEntity extends EntityBase
{
...
{
Maybe should ViewConfigUpdater::getMultivalueBaseFieldUpdateTableInfo
method be working slightly differently :
/**
* Returns the multivalue base fields update table info.
*
* @return array
* An array of multivalue base field info.
*/
protected function getMultivalueBaseFieldUpdateTableInfo() {
$table_info = &$this->multivalueBaseFieldsUpdateTableInfo;
if (!isset($table_info)) {
$table_info = [];
foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) {
- if ($entity_type->hasHandlerClass('views_data')) {
+ if ($entity_type->hasHandlerClass('views_data') && $entity_type->entityClassImplements(FieldableEntityInterface::class)) {
$base_field_definitions = $this->entityFieldManager->getBaseFieldDefinitions($entity_type_id);
...