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

CommentFileSizeAuthor
#2 3426232-2-typeError.patch1.05 KBnadim hossain
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Nadim Hossain created an issue. See original summary.

nadim hossain’s picture

StatusFileSize
new1.05 KB

rishabjasrotia made their first commit to this issue’s fork.

vivek panicker’s picture

Status: Active » Closed (cannot reproduce)

Seems some conflict with your existing configurations.

I installed the module on a Drupal 9.5 site and checked this.

anybody’s picture

gbyte’s picture

@anybody I don't understand how the issue you linked is related, if that wasn't a mistake, please explain.

anybody’s picture

Sorry that was indeed by mistake here.