Wrong detection of loadRevision

Created on 14 August 2023, 11 months ago

When running upgrade_status on my code in a Drupal 10.1.0 instance, I get 2 of these warnings:

Call to deprecated method loadRevision() of class Drupal\Core\Entity\ContentEntityStorageBase. Deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use Drupal\Core\Entity\RevisionableStorageInterface::loadRevision instead.

Looking at the 2 instances, they are:

    $revision = \Drupal::entityTypeManager()->getStorage('node')->loadRevision($rev_id);

and

    $original_objection = $this->entityTypeManager()->getStorage('node')->loadRevision($vids[0]);

where $this is an instance of a class derived from "Drupal\node\Controller\NodeController".
I think both instances are ok. Looking at the changes... this would be deprecated code:

// Deprecated method call.
$revision_entity = $entity_storage->loadRevision($revision_id);

which would need to be replaced by:

// New method call.
$revision_entity = \Drupal::entityTypeManager()->getStorage($entity_type)->loadRevision($revision_id);

which is actually what my code is already doing.

๐Ÿ› Bug report
Status

Closed: duplicate

Version

4.0

Component

Code

Created by

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

Comments & Activities

Production build 0.69.0 2024