Drupal 8.9.19 removes function getFieldValue() from Drupal\Core\Entity\ContentEntityBase.php

Created on 4 November 2021, over 3 years ago
Updated 3 January 2025, 3 months ago

Problem/Motivation

I recently upgraded my site from Drupal 8.9.16 to Drupal 8.9.19

After the upgrade I continuously see this error in my watchdog :

Error: Call to undefined method Drupal\message\Entity\Message::getFieldValue() in Drupal\social_activity\EmailTokenServices->getRelatedObject() (line 76 of \profiles\contrib\social\modules\social_features\social_activity\src\EmailTokenServices.php)

The same error is being displayed wherever we call getFieldValue() function in Drupal.

eg:

  1. social\modules\social_features\social_group\social_group.module
  2. social\modules\social_features\social_group\modules\social_group_default_route\social_group_default_route.module
  3. social\modules\social_features\social_group\modules\social_group_default_route\src\EventSubscriber\RedirectSubscriber.php
  4. social\modules\social_features\social_group\modules\social_group_flexible_group\src\Access\FlexibleGroupContentAccessCheck.php
  5. social\modules\social_features\social_group\src\CacheContext\SocialGroupJoinMethodCacheContext.php

Steps to reproduce

Upgrade Drupal 8.9.16 to Drupal 8.9.19
Use OpenSocial release 10.3.1

Proposed resolution

In the earlier version of Drupal 8.9.16 we have this function existing however, after upgrade of Drupal to 8.9.19, this function is missing from the file Drupal\Core\Entity\ContentEntityBase.php

<?php
 public function getFieldValue($field_name, $property)
?>

After manually adding this missing function back the site is working with no error.

Remaining tasks

Can someone check and resolve this in the core?

💬 Support request
Status

Closed: cannot reproduce

Version

8.9 ⚰️

Component

entity system

Created by

🇮🇳India skatheeth

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.

  • 🇳🇱Netherlands kingdutch

    For anyone else finding this through search and wondering why you have it in your code-base. You're likely using 📌 Optimize getCommentedEntity() Needs work as a patch which introduces the method on ContentEntityBase (and doesn't add it to any interfaces, so PHPStan will complain for you).

Production build 0.71.5 2024