Problem/Motivation

As a part of D9 readiness update, deprecated method calls should be removed and replaced with suggested calls.

composer require mglaman/drupal-check
./vendor/bin/drupal-check ./web/modules/contrib/date

Proposed resolution

Replace deprecated function calls with suggested replacements.

Issue fork data-3091460

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

abramm created an issue. See original summary.

abramm’s picture

Issue tags: +Amsterdam2019
abramm’s picture

Checking it now.

abramm’s picture

The src/Table.php file seems to be not used at all. Not sure why it even exists.
It may be worth reviewing the whole module code to identify dead parts.

kristen pol’s picture

Issue tags: +Drupal 9 compatibility

Per a Slack discussion with Gábor Hojtsy regarding usage of D9 tags (Drupal 9, Drupal 9 compatibility, Drupal 9 readiness, etc.), "Drupal 9 compatibility" should be used for contributed projects that need updating and "Drupal 9" was the old tag for D8 issues before the D9 branch was ready. Doing tag cleanup here based on that discussion.

suresh prabhu parkala’s picture

Status: Active » Needs review
StatusFileSize
new7.63 KB

Please review the patch file. Solved Drupal9 readiness. Thank you

BalajiDS’s picture

@Suresh Prabhu Parkala, Please change the line before apply patch #6, "core_version_requirement: 8^ || 9^" into "core_version_requirement: ^8 || ^9".

After changes done in patch #6 and applied please add the line "core_version_requirement: ^8 || ^9" in data_search.info.yml

suresh prabhu parkala’s picture

StatusFileSize
new8.03 KB
new485 bytes

Sorry about that. Here is the updated patch please review.

BalajiDS’s picture

patch #8 works fine.
Thanks, @Suresh Prabhu Parkala

andriyun’s picture

Title: Deprecations removal: src/Table.php file » Deprecations removal. Drupal 9 readiness
Issue summary: View changes

Since we have patches related to general module Drupal 9 readiness it make sense to update issue summary

andriyun’s picture

Status: Needs review » Needs work

After I applied patch #8 I see following deprecation notices in project

Warning: The use statement with non-compound name 'Drupal' has no effect in /var/www/build/docroot/modules/contrib/data/data_search/data_search.module on line 3
 27/27 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ --------------------------------------------------------------------------- 
  Line   includes/DataHandler.inc                                                   
 ------ --------------------------------------------------------------------------- 
  50     Call to deprecated function db_escape_table():                             
         in drupal:8.0.0 and is removed from drupal:9.0.0. Instead,                 
           get a database connection injected into your service from the container  
           and call escapeTable() on it. For example,                               
           $injected_database->escapeTable($table);                                 
  50     Call to deprecated function db_escape_table():                             
         in drupal:8.0.0 and is removed from drupal:9.0.0. Instead,                 
           get a database connection injected into your service from the container  
           and call escapeTable() on it. For example,                               
           $injected_database->escapeTable($table);                                 
  50     Call to deprecated function db_select():                                   
         in drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get             
           a database connection injected into your service from the container and  
           call select() on it. For example,                                        
           $injected_database->select($table, $alias, $options);                    
  146    Call to deprecated function db_delete():                                   
         in drupal:8.0.0 and is removed from drupal:9.0.0. Instead, get             
           a database connection injected into your service from the container and  
           call delete() on it. For example,                                        
           $injected_database->delete($table, $options);                            
  172    Call to deprecated function db_escape_table():                             
         in drupal:8.0.0 and is removed from drupal:9.0.0. Instead,                 
           get a database connection injected into your service from the container  
           and call escapeTable() on it. For example,                               
           $injected_database->escapeTable($table);                                 
  172    Call to deprecated function db_query():                                    
         in drupal:8.0.0 and is removed from drupal:9.0.0. Instead,                 
           get a database connection injected into your service from the container  
           and call query() on it. For example,                                     
           $injected_database->query($query, $args, $options);                      
 ------ --------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------- 
  Line   tests/data.test.inc                                                 
 ------ -------------------------------------------------------------------- 
         Reflection error: DrupalWebTestCase not found.                      
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols  
 ------ -------------------------------------------------------------------- 

 [ERROR] Found 7 errors                                             

These notices are harmless.
It looks like legacy code from Drupal 7 version.
But I think it still should be taken care

karishmaamin’s picture

StatusFileSize
new9.32 KB

Fixed deprecation in #11. Please review

veronicaseveryn’s picture

StatusFileSize
new26.96 KB

I have added more fixes for deprecated items based on #12 initial changes.