- Merge request !13695Draft: Resolve #3020910 "Entitytypemanagergethandler exception is" → (Open) created by oily
EntityTypeManager::getHandler() can throw an exception that says:
> 'The "%s" entity type did not specify a %s handler.'
However, this can be thrown if the entity type specifies the handler of the type in question, but the class isn't found.
That can happen for example if:
- there is a typo in the class name in the entity type annotation
- the handler class doesn't autoload correctly, for example, if the namespace is incorrect
- the class doesn't exist at all
In all these circumstances, the exception message is directing the developer to the wrong problem.
This is because getHandler() calls EntityType::getHandlerClass(), which in turn calls hasHandlerClass(), and that checks the class exists:
public function hasHandlerClass($handler_type, $nested = FALSE) {
$handlers = $this->getHandlerClasses();
if (!isset($handlers[$handler_type]) || ($nested && !isset($handlers[$handler_type][$nested]))) {
return FALSE;
}
$handler = $handlers[$handler_type];
if ($nested) {
$handler = $handler[$nested];
}
return class_exists($handler);
}
Active
11.0 🔥
entity system
Enhances developer experience.
Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.
The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.