Problem/Motivation
EntityViewsData does this:
if ($table_mapping = $this->storage->getTableMapping($field_definitions)) {
But the return docs for SqlEntityStorageInterface::getTableMapping() don't say that the return can be anything falsy:
* @return \Drupal\Core\Entity\Sql\TableMappingInterface
* A table mapping object for the entity's tables.
The implementation, SqlContentEntityStorage::getCustomTableMapping() always returns the result of getCustomTableMapping(), and that is always an object:
public function getCustomTableMapping(ContentEntityTypeInterface $entity_type, array $storage_definitions, $prefix = '') {
$prefix = $prefix ?: ($this->temporary ? 'tmp_' : '');
return DefaultTableMapping::create($entity_type, $storage_definitions, $prefix);
}
Steps to reproduce
Proposed resolution
Remove the if() check.