Problem/Motivation
Get the error during fresh install.
TypeError: Drupal\simple_sitemap\Entity\SimpleSitemap::getType(): Return value must be of type Drupal\simple_sitemap\Entity\SimpleSitemapTypeInterface, null returned in Drupal\simple_sitemap\Entity\SimpleSitemap->getType() (line 131 of /app/docroot/modules/contrib/simple_sitemap/src/Entity/SimpleSitemap.php).
Steps to reproduce
I have done a fresh install and after db updates and during cim step, this issue occurs.
Proposed resolution
more error handling -
public function getType(): SimpleSitemapTypeInterface {
if ($this->sitemapType === NULL) {
$type_id = $this->get('type');
if ($type_id) {
$type_entity = $this->entityTypeManager()->getStorage('simple_sitemap_type')->load($type_id);
if ($type_entity) {
$this->sitemapType = $type_entity;
} else {
// Handle case where entity is not found
throw new \RuntimeException("SimpleSitemapType entity with ID $type_id not found.");
}
} else {
// Handle case where 'type' field is empty
throw new \RuntimeException("Type field is empty for SimpleSitemap entity.");
}
}
return $this->sitemapType;
}
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
nadim hossain commentedComment #5
vivek panicker commentedSeems some conflict with your existing configurations.
I installed the module on a Drupal 9.5 site and checked this.
Comment #7
anybodyComment #8
gbyte@anybody I don't understand how the issue you linked is related, if that wasn't a mistake, please explain.
Comment #9
anybodySorry that was indeed by mistake here.