web/modules/contrib/ctools/src/Plugin/Deriver/TypedDataRelationshipDeriver.php:38

$derivative['data_type'] = $property_definition->getFieldStorageDefinition()->getPropertyDefinition($property_definition->getFieldStorageDefinition()->getMainPropertyName())->getDataType();

getMainPropertyName() can, validly, return NULL (see \Drupal\Core\Field\FieldItemInterface::mainPropertyName).

It can also invalidly return a property that doesn't exist (for example address field doesn't have value but doesn't override mainPropertyName). Not sure if we want to account for this by ensuring the property also exists?

Comments

andrewbelcher created an issue. See original summary.

andrewbelcher’s picture

Priority: Normal » Major
Status: Active » Needs review
StatusFileSize
new2.36 KB

Here is a patch that fixes the deriver issue. I tried writing a test using the map field item, but that gave core errors on trying to install... If it's important to test, we may have to write our own field type to test with.

Bumping to major as it will currently break any page that uses the relationship manager when there is an address field...

pfrenssen’s picture

I'm also hitting this bug.

The "map" field type has no main property, this could be used in the test.

Ref. \Drupal\Core\Field\Plugin\Field\FieldType\MapItem::mainPropertyName()

chris matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 4 year old patch in #2 needs a reroll.

shreyakaushik11’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new2.46 KB

I've rerolled the patch mentioned in #2.
Please review.

Status: Needs review » Needs work

The last submitted patch, 5: 2865709-5.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.