Quantcast
Viewing all articles
Browse latest Browse all 295035

Convert hook_update_dependencies() to PHP attributes

Problem/Motivation

hook_update_dependencies() declares dependencies between hook_update_N() implementations.

function hook_update_dependencies() {
  $dependencies['mymodule'][8001] = [
    'another_module' => 8003,
  ];
  $dependencies['yet_another_module'][8005] = [
    'mymodule' => 8002,
  ];
}

This is sub optimal because the dependencies are disconnected from the update hooks themselves.

Steps to reproduce

Proposed resolution

Convert hook_update_dependencies() to PHP attributes:

#[RunAfter('another_module_update_8003')]
function mymodule_update_8001() {
}

#[RunBefore('yet_another_module_update_8005')]
function mymodule_update_8002() {
}

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 295035

Trending Articles