Automated Drupal 11 compatibility fixes for entity_back_reference

Created on 23 October 2024, 7 months ago

Problem/Motivation

Hello project maintainers,

This is an automated issue to help make this module compatible with Drupal 11.

Changes will periodically be added to this issue that remove deprecated API uses. To stop further changes from being posted, change the status to anything other than Active, Needs review, Needs work or Reviewed and tested by the community. Alternatively, you can remove the "ProjectUpdateBotD11" tag from the issue to stop the bot from posting updates.

The changes will be posted by the Project Update Bot official user account. This account will not receive any issue credit contributions for itself or any company.

Proposed resolution

You have a few options for how to use this issue:

  1. Accept automated changes until this issue is closed

    If this issue is left open (status of Active, Needs review, Needs work or Reviewed and tested by the community) and the "ProjectUpdateBotD11" tag is left on this issue, new changes will be posted periodically if new deprecation fixes are needed.

    As the Drupal Rector project improves and is able to fix more deprecated API uses, the changes posted here will cover more of the deprecated API uses in the module.

    Patches and/or merge requests posted by others are ignored by the bot, and general human interactions in the issue do not stop the bot from posting updates, so feel free to use this issue to refine bot changes. The bot will still post new changes then if there is a change in the new generated patch compared to the changes that the bot posted last. Those changes are then up to humans to integrate.

  2. Leave open but stop new automated changes.

    If you want to use this issue as a starting point to remove deprecated API uses but then don't want new automated changes, remove the "ProjectUpdateBotD11" tag from the issue and use it like any other issue (the status does not matter then). If you want to receive automated changes again, add back the "ProjectUpdateBotD11" tag.

  3. Close it and don't use it

    If the maintainers of this project don't find this issue useful, they can close this issue (any status besides Active, Needs review, Needs work and Reviewed and tested by the community) and no more automated changes will be posted here.

    If the issue is reopened, then new automated changes will be posted.

    If you are using another issue(s) to work on Drupal 11 compatibility it would be very useful to other contributors to add those issues as "Related issues" when closing this issue.

Remaining tasks

Using the patches

  1. Apply the latest patch in the comments by Project Update Bot or human contributors that made it better.
  2. Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.
  3. Provide feedback about how the testing went. If you can improve the patch, post an updated patch here.

Using the merge request

  1. Review the merge request and test it.
  2. Thoroughly test the changes. These changes are automatically generated so they haven't been tested manually or automatically.
  3. Provide feedback about how the testing went. If you can improve the merge request, create a new branch and merge request and work from there.

Warning: The 'project-update-bot-only' branch will always be overwritten. Do not work in that branch!

Providing feedback

If there are problems with one of the changes posted by the Project Update Bot , such as it does not correctly replace a deprecation, you can file an issue in the Drupal Rector issue queue . For other issues with the bot, for instance if the issue summary created by the bot is unclear, use the Project analysis issue queue .

📌 Task
Status

Active

Version

1.0

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @project update bot
  • This is an automated patch generated using Upgrade Status and Drupal Rector. Please see the issue summary for more details. A merge request (MR) is also openend and updated.

    It is important that any automated tests available are run and that you manually test the changes.

    Drupal 11 Compatibility

    According to the Upgrade Status module these changes make this module compatible with Drupal 11! 🎉
    Therefore these changes update the info.yml file for Drupal 11 compatibility.

    Leaving this issue open, even after committing the current patch or merging the MR, will allow the Project Update Bot to post additional Drupal 11 compatibility fixes as they become available in Drupal Rector.

    Debug information

    Bot run #11-318179

    These packages were used to generate the fixes:

    1. drupal/upgrade_status: 4.3.6
    2. mglaman/phpstan-drupal: 1.3.1
    3. palantirnet/drupal-rector: 0.20.3
  • Status changed to Needs review about 1 month ago
  • 🇮🇳India flutterstack

    #2 is works fine.

    In number #5 I have updated README.md file. kindly review and merge the code. thank you.

  • 🇨🇦Canada alberto56

    @flutterstack thanks! The patch works if I get the code via git, however if I use composer to get 1.0.0, or if I donwload the tar.gz, the Drupal package manager adds some extra code to the info file, causing the patch to fail:

    [root@VM2401-001 entity_back_reference]# cat entity_back_reference.info.yml
    name: Entity Back Reference
    type: module
    description: 'Backtracks the entities referenced in other entity'
    package: Entity Back Reference
    core_version_requirement: ^9 || ^10
    # version: '1.0.0'
    # project: 'entity_back_reference'
    # datestamp: 1722608384
    
    # Information added by Drupal.org packaging script on 2024-08-05
    version: '1.0.0'
    project: 'entity_back_reference'
    datestamp: 1722877289
    [root@VM2401-001 entity_back_reference]# curl -O https://www.drupal.org/files/issues/2025-04-10/3482928-automated-drupal-11-compatibility-and-readme-update.patch
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2282  100  2282    0     0  13423      0 --:--:-- --:--:-- --:--:-- 13423
    [root@VM2401-001 entity_back_reference]# patch -p1 < 3482928-automated-drupal-11-compatibility-and-readme-update.patch
    patching file README.md
    patching file entity_back_reference.info.yml
    Hunk #1 FAILED at 2.
    1 out of 1 hunk FAILED -- saving rejects to file entity_back_reference.info.yml.rej

    Could you please make a version of the patch which applies to version 1.0.0 if it is downloaded via tar.gz or composer? Thanks!

  • 🇮🇳India flutterstack

    Steps I have followed

    download entity_back_reference-1.0.0 tag zip from entity_back_reference module releases page.

    wget https://ftp.drupal.org/files/projects/entity_back_reference-1.0.0.zip

    unzip entity_back_reference-1.0.0.zip file in in web/modules/custom/ folder

    deprecation check
    ------

    # php vendor/bin/drupal-check -d web/modules/custom/entity_back_reference
    Deprecated: The drupal_root parameter is deprecated. Remove it from your configuration. Drupal Root is discovered automatically. in /var/www/html/vendor/mglaman/phpstan-drupal/src/Drupal/DrupalAutoloader.php on line 94
     1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
    
    
     [OK] No errors                                                                 
    
    Thanks for using drupal-check!
    
    Consider sponsoring the development of the maintainers which make drupal-check possible:
    
    - phpstan (ondrejmirtes): https://github.com/sponsors/ondrejmirtes
    - phpstan-deprecation-rules (ondrejmirtes)): https://github.com/sponsors/ondrejmirtes
    - phpstan-drupal (mglaman)): https://github.com/sponsors/mglaman
    - drupal-check (mglaman)): https://github.com/sponsors/mglaman
    

    Run the entity_back_reference 1.0.0 tag for analysis:

    aea110c218f7:/var/www/html# php vendor/bin/drupal-check -a web/modules/custom/entity_back_reference
    Deprecated: The drupal_root parameter is deprecated. Remove it from your configuration. Drupal Root is discovered automatically. in /var/www/html/vendor/mglaman/phpstan-drupal/src/Drupal/DrupalAutoloader.php on line 94
     1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
    
     ------ -------------------------------------------------------------------------------------- 
      Line   src/Services/BackReferenceFinder.php                                                  
     ------ -------------------------------------------------------------------------------------- 
      40     Property                                                                              
             Drupal\entity_back_reference\Services\BackReferenceFinder::$backReferenceFields       
             type has no value type specified in iterable type array.                              
             💡 See:                                                                               
                https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type  
      47     Property                                                                              
             Drupal\entity_back_reference\Services\BackReferenceFinder::$backReferenceEntityIds    
             type has no value type specified in iterable type array.                              
             💡 See:                                                                               
                https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type  
      82     Property                                                                              
             Drupal\entity_back_reference\Services\BackReferenceFinder::$entityQuery               
             (Drupal\Core\Entity\Query\Sql\QueryFactory) does not accept                           
             Drupal\Core\Entity\Query\QueryInterface.                                              
      131    Left side of && is always true.                                                       
             💡 Because the type is coming from a PHPDoc, you can turn off this                    
                check by setting treatPhpDocTypesAsCertain: false in your                          
                /tmp/drupal_check_phpstan_1744386558.neon.                                         
     ------ -------------------------------------------------------------------------------------- 
    
    
     [ERROR] Found 4 errors                                                         
    
    Thanks for using drupal-check!
    
    Consider sponsoring the development of the maintainers which make drupal-check possible:
    
    - phpstan (ondrejmirtes): https://github.com/sponsors/ondrejmirtes
    - phpstan-deprecation-rules (ondrejmirtes)): https://github.com/sponsors/ondrejmirtes
    - phpstan-drupal (mglaman)): https://github.com/sponsors/mglaman
    - drupal-check (mglaman)): https://github.com/sponsors/mglaman
    
  • 🇮🇳India flutterstack

    kindly try to apply patch #8 on entity_back_reference-1.0.0 tag and review

  • 🇮🇳India flutterstack

    I have tried to apply patch #8 on

    download entity_back_reference-1.0.x branch code zip from entity_back_reference module releases page.

    wget https://ftp.drupal.org/files/projects/entity_back_reference-1.0.x-dev.zip

    unzip entity_back_reference-1.0.x-dev.zip file in in web/modules/custom/ folder

    try to apply patch #8

    # patch -p1 < 3482928-automated-drupal-11-compatibility-and-readme-update-tag-1.0.0.patch 
    patching file README.md
    patching file entity_back_reference.info.yml
    Hunk #1 FAILED at 2.
    1 out of 1 hunk FAILED -- saving rejects to file entity_back_reference.info.yml.rej
    patching file src/Services/BackReferenceFinder.php
    

    patch was failed because in entity_back_reference.info.yml of 1.0.x-dev code we have version: '1.0.x-dev' hence patch failed.

    kindly apply #9 on entity_back_reference-1.0.x and review .

    thank you

  • 🇨🇦Canada alberto56

    Still does not work for me.

    If I remove this:

    -# version: '1.0.0'
    -# project: 'entity_back_reference'
    -# datestamp: 1722608384
    -
    -# Information added by Drupal.org packaging script on 2024-08-05
    

    from the patch at #9, then it works.

    Here is a new patch

  • 🇨🇦Canada alberto56

    Trying again.

  • 🇨🇦Canada alberto56

    Here is a new version of the patch; I had mistakenly changed ^9 || ^10 for ^9 || ^11; in this version it's ^10 || ^11

Production build 0.71.5 2024