Call to undefined method Drupal\Core\TypedData\DataDefinition::getPropertyDefinitions()

Created on 1 August 2025, 11 days ago

When using the Autocomplete widget, for some types the following error is thrown when searching for items: Call to undefined method Drupal\Core\TypedData\DataDefinition::getPropertyDefinitions()

The origin of this error leads back to the the getSpecifiedProperties method, in the XeroItemBase class. Here the method getProperties on the parent class is called. In this method, then the getPropertyDefinitions method is called on Drupal\Core\TypedData\DataDefinition.

For some xero data definitions, the getpropertyDefinition method is not available. I don't know why exactly.
A quick way to resolve this is a method_exists upon $this->definiton, to check in the getSpecifiedProperties method.

   if (method_exists($this->definition, 'getPropertyDefinitions')) {
      $properties = $this->getProperties(FALSE);
    } else {
      $properties = [];
    }

Maybe there is a better way, but this resolves the issue for me.

πŸ› Bug report
Status

Active

Version

3.1

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium kensae

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024