Problem/Motivation
A huge number of services are missing from the 11.x documentation. Here are just some that can't be found (and yes, they are still all part of core 11.x and listed in the core.services.yml, and they all show up in the 10.x, 9.x etc. documentation):
- config.factory
- current_user
- entity_type.manager
- event_dispatcher
- logger.factory
- module_handler
Steps to reproduce
This is what I mean by can't be found:
A search on a service name (in the main search box) should bring up results.
For example, in the 10.x documentation, search for entity_type.manager
:
https://api.drupal.org/api/drupal/core%21core.services.yml/service/entit...
This brings up a page showing the class that provides the service, a link to core.services.yml
, and a list of files that use this service.
This is helpful.
But in the 11.x documentation, a huge number of searches like this yield no result at all.
For the above search, when you open up the "Same name and namespace in other branches" section you can see that entity_type.manager
is not listed as being present in 11.x. That's obviously wrong.
Searching directly:
https://api.drupal.org/api/drupal/11.x/search/entity_type.manager
returns nothing.
Likewise, going directly to the services search:
https://api.drupal.org/api/drupal/services/11.x
returns nothing for entity_type.manager
Probable cause
Services can now be autowired, and have aliases.
Core services provide aliases for autowiring β
My guess is that core.service.yml
is not being parsed correctly for this change. However, the change was made back in D10.1 and the 10.x documentation DOES work correctly for these services, so I'm not sure how this fully explains the problem.
For example, in D10, core.services.yml
looks like this for the current_user service:
current_user:
class: Drupal\Core\Session\AccountProxy
arguments: ['@event_dispatcher']
While in D11 it looks like this:
current_user:
class: Drupal\Core\Session\AccountProxy
arguments: ['@event_dispatcher']
Drupal\Core\Session\AccountInterface: '@current_user'
Drupal\Core\Session\AccountProxyInterface: '@current_user'
In this case, there are aliases for the purpose of autowiring, so that Symfony can automatically inject the service based on either the class name or one of the two interface names.
Searching for current_user
, AccountProxy
, AccountInterface
, or AccountProxyInterface
finds nothing in the 11.x search of services, but DOES work in the 10.x search.