Skip to content
Snippets Groups Projects
Commit 3188fd98 authored by Sahana  N's avatar Sahana N Committed by Aaron Bauman
Browse files

Issue #3103335 by Sahana _N: Remove deprecated code

parent 813a50e5
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,7 @@ function salesforce_mapping_update_8001(&$sandbox) { ...@@ -22,7 +22,7 @@ function salesforce_mapping_update_8001(&$sandbox) {
if (empty($sandbox['progress'])) { if (empty($sandbox['progress'])) {
$sandbox['progress'] = 0; $sandbox['progress'] = 0;
$sandbox['current_id'] = 0; $sandbox['current_id'] = 0;
$sandbox['max'] = db_query("SELECT count(*) FROM salesforce_mapped_object")->fetchField(); $sandbox['max'] = \Drupal::service('database')->query("SELECT count(*) FROM salesforce_mapped_object")->fetchField();
if (empty($sandbox['max'])) { if (empty($sandbox['max'])) {
$sandbox['#finished'] = 1; $sandbox['#finished'] = 1;
return t('No mapped objects to update.'); return t('No mapped objects to update.');
...@@ -32,7 +32,7 @@ function salesforce_mapping_update_8001(&$sandbox) { ...@@ -32,7 +32,7 @@ function salesforce_mapping_update_8001(&$sandbox) {
// Have to go directly to the database for the entity values because they've // Have to go directly to the database for the entity values because they've
// been removed from baseFieldDefinitions, therefore they don't get attached // been removed from baseFieldDefinitions, therefore they don't get attached
// to the entity on load. // to the entity on load.
$mapped_objects = db_query("SELECT id, entity_type_id, entity_id FROM salesforce_mapped_object WHERE id > {$sandbox['current_id']} ORDER BY id ASC LIMIT 3"); $mapped_objects = \Drupal::service('database')->query("SELECT id, entity_type_id, entity_id FROM salesforce_mapped_object WHERE id > {$sandbox['current_id']} ORDER BY id ASC LIMIT 3");
foreach ($mapped_objects as $mapped_object_data) { foreach ($mapped_objects as $mapped_object_data) {
$sandbox['current_id'] = $mapped_object_data->id; $sandbox['current_id'] = $mapped_object_data->id;
...@@ -61,17 +61,18 @@ function salesforce_mapping_update_8001(&$sandbox) { ...@@ -61,17 +61,18 @@ function salesforce_mapping_update_8001(&$sandbox) {
* Drop vestigial fields manually, since entity update refuses to do it. * Drop vestigial fields manually, since entity update refuses to do it.
*/ */
function salesforce_mapping_update_8002() { function salesforce_mapping_update_8002() {
$database = \Drupal::service('database');
try { try {
// Drop this index if it exists. // Drop this index if it exists.
db_drop_index('salesforce_mapped_object', 'entity__mapping'); $database->schema()->dropIndex('salesforce_mapped_object', 'entity__mapping');
} }
catch (\Exception $e) { catch (\Exception $e) {
// Noop. // Noop.
} }
db_drop_field('salesforce_mapped_object', 'entity_id'); $database->schema()->dropField('salesforce_mapped_object', 'entity_id');
db_drop_field('salesforce_mapped_object', 'entity_type_id'); $database->schema()->dropField('salesforce_mapped_object', 'entity_type_id');
db_drop_field('salesforce_mapped_object_revision', 'entity_id'); $database->schema()->dropField('salesforce_mapped_object_revision', 'entity_id');
db_drop_field('salesforce_mapped_object_revision', 'entity_type_id'); $database->schema()->dropField('salesforce_mapped_object_revision', 'entity_type_id');
} }
/** /**
......
...@@ -42,7 +42,7 @@ function salesforce_pull_update_8002() { ...@@ -42,7 +42,7 @@ function salesforce_pull_update_8002() {
* Convert salesforce_pull_last* timestamps key-values into arrays. * Convert salesforce_pull_last* timestamps key-values into arrays.
*/ */
function salesforce_pull_update_8001() { function salesforce_pull_update_8001() {
$kv = db_query("SELECT name, value FROM key_value WHERE name like 'salesforce_pull_last%'")->fetchAllKeyed(); $kv = \Drupal::service('database')->query("SELECT name, value FROM key_value WHERE name like 'salesforce_pull_last%'")->fetchAllKeyed();
$sync = []; $sync = [];
$delete = []; $delete = [];
foreach ($kv as $key => $value) { foreach ($kv as $key => $value) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment