Configurable

DBRector

Fixes deprecated db_delete() calls

-db_delete($table, $options);
+\Drupal::database()->delete($table, $options);

Configure your rector.php:

<?php

use DrupalRector\Drupal8\Rector\Deprecation\DBRector;
use DrupalRector\Drupal8\Rector\ValueObject\DBConfiguration;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withConfiguredRule(DBRector::class, [
        new DBConfiguration('db_delete', 2),
    ]);

-db_insert($table, $options);
+\Drupal::database()->insert($table, $options);

Configure your rector.php:

<?php

use DrupalRector\Drupal8\Rector\Deprecation\DBRector;
use DrupalRector\Drupal8\Rector\ValueObject\DBConfiguration;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withConfiguredRule(DBRector::class, [
        new DBConfiguration('db_insert', 2),
    ]);

-db_query($query, $args, $options);
+\Drupal::database()->query($query, $args, $options);

Configure your rector.php:

<?php

use DrupalRector\Drupal8\Rector\Deprecation\DBRector;
use DrupalRector\Drupal8\Rector\ValueObject\DBConfiguration;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withConfiguredRule(DBRector::class, [
        new DBConfiguration('db_query', 3),
    ]);

-db_select($table, $alias, $options);
+\Drupal::database()->select($table, $alias, $options);

Configure your rector.php:

<?php

use DrupalRector\Drupal8\Rector\Deprecation\DBRector;
use DrupalRector\Drupal8\Rector\ValueObject\DBConfiguration;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withConfiguredRule(DBRector::class, [
        new DBConfiguration('db_select', 3),
    ]);

-db_update($table, $options);
+\Drupal::database()->update($table, $options);

Configure your rector.php:

<?php

use DrupalRector\Drupal8\Rector\Deprecation\DBRector;
use DrupalRector\Drupal8\Rector\ValueObject\DBConfiguration;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withConfiguredRule(DBRector::class, [
        new DBConfiguration('db_update', 2),
    ]);