Problem

I just tried upgrading from Drupal 11.1.8 to 11.2.0.

composer update went smoothly.

However, drush updatedb did not go well.

I got the following message on the update block_post_update_set_menu_block_depth_to_null_if_zero database update:

Error: Call to undefined method Drupal\datetime\DateTimeViewsHelper::fieldViewsDataHelper() in datetime_type_field_views_data_helper() (line 39 of /var/www/rouen.fr/app/core/modules/datetime/datetime.module)

Looking in the offending file https://github.com/drupal/drupal/blob/11.x/core/modules/datetime/datetime.module, it is specified that:
"datetime_type_field_views_data_helper() is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use \Drupal::service(\‘datetime.views_helper\’)->fieldViewsDataHelper($field_storage, $data, $column_name). See https://www.drupal.org/node/3489502."

But when I look for the fieldViewsDataHelpermethod, it does not appear anywhere!

However, there is a method called fieldViewsData in the file https://github.com/drupal/drupal/blob/11.x/core/modules/datetime/src/Hook/DatetimeViewsHooks.php

Could this be an error in the update code?

Steps to reproduce

From a Drupal 11.1.8:

composer update
drush updatedb

Issue fork drupal-3531044

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

zigazou created an issue. See original summary.

nicxvan’s picture

I think we updated the method name but forgot the deprecation: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/datet...

That and the comment probably needs to be updated to call the method in the helper.

nicxvan’s picture

https://www.drupal.org/project/drupal/issues/3489415 is the issue where this was added.

godotislate made their first commit to this issue’s fork.

godotislate’s picture

Version: 11.2.x-dev » 11.x-dev
nicxvan’s picture

Yes it should call buildViewsData

nicxvan’s picture

Priority: Normal » Critical
Status: Active » Reviewed & tested by the community

This was the intended replacement.

Confirmed by finding and reviewing the original issue.

I don't think this needs a test under the new policy.

Not 100% sure on critical, but it seems appropriate.

Only remaining mystery is how the update hook hit this, I suspect a custom or contrib hook implementation called the helper directly.

  • catch committed 06d6bd10 on 11.2.x
    Issue #3531044 by godotislate, nicxvan, zigazou: Unknown...

  • catch committed 85b60226 on 11.x
    Issue #3531044 by godotislate, nicxvan, zigazou: Unknown...
catch’s picture

Version: 11.x-dev » 11.2.x-dev
Status: Reviewed & tested by the community » Fixed

Yes @zigazou if you find out which module was calling this function, that would be useful information to add here - can either get a backtrace or grep your local code base.

Either way the bug itself is obvious if not how it was triggered. Committed/pushed to 11.x and cherry-picked to 11.2.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.