Problem
The votingapi_views_data_alter function in votingapi.views.inc uses an empty check on the result of EntityTypeManager::getStorage to see if the entity type vote_type is missing. In the case it's missing no views data is altered.
EntityTypeManager::getStorage doesn't return NULL for a missing entity. Instead it throws a PluginNotFoundException when the entity does not exist.
Since votingapi doesn't depend on a module that may provide this entity type the scenario that the entity does not (yet) exist can happen during installation or uninstallation.
Solution
Change the empty() check if-statement into a try {} catch() {} block that will return when there's a PluginNotFoundException.
Comments
Comment #2
kingdutchTo help editors I've added a comment about the result of the
\Drupal::service()call. IDEs may now complain that we're only catchingPluginNotFoundExceptionand not anInvalidPluginDefinitionException. However, that latter exception is not one we expect and should be presented to a user. We only expect (and handle) the case where the entity type is not available.Comment #3
andralex commentedTested locally and it looks good.
Comment #4
alex_optimFor me too.
Comment #5
pifagor commentedComment #7
pifagor commented