In drupal 8 we should not use the depreciated db_queries.

Comments

Munavijayalakshmi created an issue. See original summary.

Munavijayalakshmi’s picture

Assigned: Munavijayalakshmi » Unassigned
Status: Active » Needs review
StatusFileSize
new7.71 KB
davps’s picture

Assigned: Unassigned » davps
Parent issue: » #2711663: [meta] Node Order 8.x Roadmap
davps’s picture

Assigned: davps » Unassigned
Status: Needs review » Needs work

Thanks for patch, but need modify it. For classes, interfaces and etc. need use dependency injection method for accessing and using services.

Dependency injection is the preferred method for accessing and using services in Drupal 8 and should be used whenever possible. Rather than calling out to the global services container, services are instead passed as arguments to a constructor or injected via setter methods. Many of the controller and plugin classes provided by modules in core make use of this pattern and serve as a good resource for seeing it in action.

vuil’s picture

Assigned: Unassigned » vuil
Status: Needs work » Active
vuil’s picture

Assigned: vuil » Unassigned
Related issues: +#3072720: Drupal 9 Deprecated Code Report for Node Order

Separate the issues of DI need or not DI need (nodeorder.module)...
because of huge updates...

Add #3072720 Update the deprecated functions in nodeorder.module
The issue is related to nodeorder.module D9 update only!

vuil’s picture

And, add the second issue:
#3072723 Update classes, interfaces and etc. need use dependency injection (DI) only!

vuil’s picture

Someone to help with the Kernel Tests (install/uninstall) issues mentioned in #3072720: Update the deprecated functions in nodeorder.module?

Thank you in advance.

sergiu stici’s picture

Status: Active » Needs review
StatusFileSize
new14.31 KB
php drupal-check.phar modules/contrib/nodeorder/
 14/14 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ---------------------------------------------- 
  Line   nodeorder.install                             
 ------ ---------------------------------------------- 
  31     Call to deprecated function db_add_field().   
  44     Call to deprecated function db_drop_index().  
  45     Call to deprecated function db_drop_field().  
 ------ ---------------------------------------------- 

 ------ ----------------------------------------------------------------------------------- 
  Line   nodeorder.module                                                                   
 ------ ----------------------------------------------------------------------------------- 
  43     Call to deprecated method getVocabularyId() of class Drupal\taxonomy\Entity\Term.  
  103    Call to deprecated method entityManager() of class Drupal.                         
  113    Call to deprecated function db_select().                                           
  125    Call to deprecated function db_update().                                           
  134    Call to deprecated function drupal_set_message().                                  
  142    Call to deprecated method entityManager() of class Drupal.                         
  149    Call to deprecated function db_update().                                           
  155    Call to deprecated function drupal_set_message().                                  
  176    Call to deprecated function db_select().                                           
  240    Call to deprecated function db_update().                                           
 ------ ----------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------- 
  Line   src/Access/NodeOrderAccess.php                                                     
 ------ ----------------------------------------------------------------------------------- 
  70     Call to deprecated method getVocabularyId() of class Drupal\taxonomy\Entity\Term.  
 ------ ----------------------------------------------------------------------------------- 

 ------ --------------------------------------------------- 
  Line   src/NodeOrderListBuilder.php                       
 ------ --------------------------------------------------- 
  292    Call to deprecated function drupal_set_message().  
 ------ --------------------------------------------------- 

 ------ ----------------------------------------------- 
  Line   src/NodeOrderManager.php                       
 ------ ----------------------------------------------- 
  60     Call to deprecated function db_update().       
  68     Call to deprecated function db_select().       
  82     Call to deprecated function db_select().       
  96     Call to deprecated function db_update().       
  127    Call to deprecated function db_select().       
  180    Call to deprecated function db_select().       
  212    Call to deprecated function db_query_range().  
  273    Call to deprecated function db_select().       
  320    Call to deprecated function db_select().       
  337    Call to deprecated function db_update().       
 ------ ----------------------------------------------- 

 ------ ----------------------------------------------------------------------------------------------------------------- 
  Line   src/Tests/NodeorderCrudTest.php                                                                                  
 ------ ----------------------------------------------------------------------------------------------------------------- 
  13     Class Drupal\nodeorder\Tests\NodeorderCrudTest extends deprecated class Drupal\taxonomy\Tests\TaxonomyTestBase.  
  47     Call to method setUp() of deprecated class Drupal\taxonomy\Tests\TaxonomyTestBase.                               
  57     Call to deprecated function entity_create().                                                                     
  68     Call to deprecated function entity_create().                                                                     
  86     Call to deprecated function entity_get_form_display().                                                           
  91     Call to deprecated function entity_get_display().                                                                
  299    Call to deprecated function db_select().                                                                         
 ------ ----------------------------------------------------------------------------------------------------------------- 

                                                                                                                        
 [ERROR] Found 32 errors

I use DI and provide a new patch, please review.

Status: Needs review » Needs work

The last submitted patch, 9: deprecated-2871722-9.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

priyanka_chauhan31’s picture

Assigned: Unassigned » priyanka_chauhan31

Hi, I am working on it.

priyanka_chauhan31’s picture

Assigned: priyanka_chauhan31 » Unassigned
Status: Needs work » Needs review
StatusFileSize
new14.86 KB

Hi, Please review the patch .

xpersonas’s picture

I believe this issue has been resolved with merge requests on issue #3072720.
https://www.drupal.org/project/nodeorder/issues/3072720#comment-14981147

Drupal 9 Compatible: 8.x-1.x-dev
Drupal 10 Compatible: 2.0.0

If something necessary was missed, please let me know.

xpersonas’s picture

Status: Needs review » Fixed
vuil’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.