By roderik on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.0.x
Introduced in version:
8.0-ALPHA11
Issue links:
Description:
All SQL queries have been moved from node.module into a storage controller, which can now be overridden from other non-SQL storage subsystems.
In the process, the function node_revision_list(), which output a specific set of node revision properties, has been removed. If you used this function, you will now need to load node revisions by yourself and get the properties from the loaded revisions. See below for some guidance.
The below Drupal 8 code snippet contains an example of calling a method inside the storage controller. For all available methods, see the API documentation for NodeStorageInterface.
Drupal 7:
$results = node_revision_list($node);
// Note: sorted descending by revision id.
foreach ($results as $result) {
$owner_uid = $result->uid;
$revision_message = $result->log;
// ...do more things...
}
Drupal 8:
$vids = \Drupal::entityManager()->getStorage('node')->revisionIds($node);
// Note: sorted ascending by revision id.
foreach ($vids as $vid) {
if ($revision = node_revision_load($vid)) {
$owner = $revision->getOwner();
$revision_message = $revision->log->value;
// ...do more things...
}
}
Impacts:
Module developers