Skip to content

Argument #1 ($storeId) must be of type int, string given error

I am having a feed which is run every night with crons. My instance is magento 2.4.6-p2.

I am using this function to get store id:

public function execute()
    {
        foreach ($this->storeManager->getStores() as $store) {
            // Only generate feeds when feed notification is active
            if ($this->coreConfig->isDailyFeedActive($store->getId())) {
                $this->logger->debug('MyModule: Nightly Feeds being run for Store View ' . $store->getId());
                $this->feedRunner->allFeeds($store->getId());
            }
        }
    }

But it return error when cron run:

Argument #1 ($storeId) must be of type int, string given

I can’t figure out what I do wrong and I can’t get the store id. Instead of getting a number I get a string as error says

Any help please??