Problem/Motivation

Drupal-check returns 2 deprecation errors.

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   src/Form/GroupAddForm.php                                                                                                                                               
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  62     Parameter $entityQuery of method Drupal\context_groups\Form\GroupAddForm::__construct() has typehint with deprecated class Drupal\Core\Entity\Query\QueryFactory:       
         in drupal:8.3.0 and is removed from drupal:9.0.0. Use                                                                                                                   
         \Drupal\Core\Entity\EntityStorageInterface::getQuery() or                                                                                                               
         \Drupal\Core\Entity\EntityStorageInterface::getAggregateQuery() instead.                                                                                                
  189    Call to deprecated constant REGIONS_ALL: Deprecated in drupal:8.3.0 and is removed from drupal:9.0.0. Use \Drupal\block\BlockRepositoryInterface::REGIONS_ALL instead.  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 

Proposed resolution

Replace deprecated code.

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

nace_fric created an issue. See original summary.

nace_fr’s picture

Issue summary: View changes
sahana _n’s picture

Status: Active » Needs review
StatusFileSize
new1.89 KB

Please review the patch.

nace_fr’s picture

Status: Needs review » Reviewed & tested by the community

I have tested the patch from #3. It applied successfully and solved all deprecation errors. Changing status to RTBC.

maxmendez’s picture

StatusFileSize
new2.26 KB

Updated patch to replace core_version_requirement instead of core in .info.yml

john_a’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new2.58 KB

Found an issue with the updated D9 patch.

To reproduce the issue:

  • Navigate to /admin/structure/context/add
  • Create a new context with label "test" -> Save
  • Click "Add reaction"
  • Click "Blocks"
  • Click "+ Add group"

Expected results:

  • Modal for "Add group" appears

Actual result:

Watchdog log

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "entity.query". Did you mean one of these: "entity.query.config", "entity.query.sql", "pgsql.entity.query.sql", "entity.query.null", "entity.query.keyvalue"? in Drupal\Component\DependencyInjection\Container->get() (line 156 of /var/www/adg/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php).

Solution

__construct() has already been updated, however, $container->get('entity.query') was mistakenly left in the create() function.

Updated patch is attached

maxmendez’s picture

Tested steps to reproduce and the patch work as expected. Thanks for your work.

skullhole made their first commit to this issue’s fork.

sershevchyk’s picture

Status: Needs work » Reviewed & tested by the community

Code from MR3 works fine for me. I think we can merge this code.
https://git.drupalcode.org/project/context_groups/-/merge_requests/3.diff

icurk made their first commit to this issue’s fork.

  • icurk committed fc7d820 on 8.x-1.x authored by skullhole
    Issue #3127817 by skullhole, MaxMendez, Sahana _N, john_a: Drupal 9...
icurk’s picture

icurk’s picture

Status: Reviewed & tested by the community » Fixed
icurk’s picture

Version: 8.x-1.x-dev » 8.x-2.0

Status: Fixed » Closed (fixed)

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