By Crell on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Description:
The database subsystem is now loaded using a PSR-4 compatible class loader, which means it is using namespaces. In most cases this will have no impact on module code. The exception is when module code is specifying a particular database class by name, in which case it will need to "use" the class at the top of the file. That is most likely to happen with exceptions or in hook_query_alter().
Example:
// Drupal 7:
function mymodule_query_alter(QueryAlterableInterface $query) {
// ...
}
// Drupal 8:
use Drupal\Core\Database\Query\AlterableInterface;
// ...
function mymodule_query_alter(AlterableInterface $query) {
// ...
}
See the namespace coding standards for more information.
Impacts:
Module developers