Missing proxy class 'Drupal\book_tree_menu\ProxyClass\oscBookManager' for lazy service 'book.manager

Created on 7 January 2024, over 1 year ago
Updated 28 February 2024, about 1 year ago

Problem/Motivation

After updating to D10.2 proxy class is needed from book module

Proposed resolution a proxy class is generated using this command
php core/scripts/generate-proxy-class.php 'Drupal\book_tree_menu\oscBookManager' "docroot/modules/contrib/book_tree_menu/src"

and then made changes to the generated class to take book manager instead of BookManagerInterface

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡―πŸ‡΄Jordan suhaib_hija

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

Merge Requests

Comments & Activities

  • Issue created by @suhaib_hija
  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States bkosborne New Jersey, USA

    Yes, this is needed, but in the patch provided you had the proxy class extend from BookManager, but I'm not sure why. I don't think you need to overwrite anything at all from what the script created. I created a Merge Request with the unaltered code of the created proxy class.

    Also bumping to major as this is needed for Drupal 10.2.x.

  • Status changed to Needs review about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States bkosborne New Jersey, USA
  • πŸ‡¨πŸ‡¦Canada al_trottier

    Creating a patch to add the file generated by the script.

  • πŸ‡¬πŸ‡§United Kingdom andy inman Gloucestershire, UK

    Patch #6 worked for me - the warning "Missing proxy class 'Drupal\book_tree_menu\ProxyClass\oscBookManager' for lazy service 'book.manager'" was previously appearing after every drush cr, it's gone after applying the patch.

  • πŸ‡³πŸ‡±Netherlands promes

    My Drupal version is 10.3.10 and book version 2.0.0-alpha5.
    After the initial install I got the error. I deinstalled the module. I patched the module with the patch of #6 and installed it again. Now I get this error:
    PHP Fatal error: Declaration of Drupal\\book_tree_menu\\ProxyClass\\oscBookManager::bookTreeAllData($bid, $link = null, $max_depth = null) must be compatible with Drupal\\book\\BookManagerInterface::bookTreeAllData(int $bid, ?array $link = null, ?int $max_depth = null, ?int $min_depth = null): array in /xxx/web/modules/contrib/book_tree_menu/src/ProxyClass/oscBookManager.php on line 72', referer: https://example.com/admin/modules

    And many more interface differences.

  • πŸ‡―πŸ‡΄Jordan suhaib_hija

    Reroll patch for D10.4.4

  • πŸ‡ΊπŸ‡ΈUnited States rex.barkdoll

    Hi, this became an issue for our site today. Not sure if there was a recent update that made this patch necessary again, but I applied the patch and it resolved the issue.

    I feel like I've had to apply the recommended php command in the past to fix the issue, this time, the patch was what was needed. Can it be merged into the official code so this bug stops happening?

    Thank you for everyone's work on this fix :)

  • πŸ‡ΊπŸ‡ΈUnited States nys-osc

    Please upgrade to 3.0.1 and contributed module Book 2.0.0

Production build 0.71.5 2024