Score:0

menu.tree_storage service is missing from my site

in flag

I have upgraded my Drupal 9 site to Drupal 10.1. One of my custom module uses \Drupal::service('menu.tree_storage')->loadByProperties(); which works fine in drupal 9.5.9, but I get the following error message in Drupal 10.1.

You have requested a non-existent service "menu.tree_storage"

When I used drush dcs | grep "tree", the menu.tree_storage is missing from my Drupal 10 site. Yet it is listed as an argument in the core.services.yml file.

Is there a way to fix this?

id flag
Very little has changed in the \Drupal\Core\DependencyInjection component between Drupal 9.5 and 10.1 except, notably, the change in dependency symfony/dependency-injection from ^4.4 to ^6.3. As this is a service marked `private` that could be involved. What is the `dcs` Drush subcommand? I'm not familiar with it.
hobbsie avatar
in flag
drush dcs is an alias of drush devel:services which gets a list of available services
id flag
That’s from the Devel module I suppose.
Score:-1
us flag

Menus are config entities and can be loaded using the entity type manager instead of using menu tree storage service.

https://www.drupal.org/node/3027453

Benjen avatar
ng flag
I don't believe menu content are entities so they cannot be loaded using EntityTypeManager. Only the menus themselves are configuration entities.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.