0

I'm getting this error :

Notice: Object of class Magento\Store\Model\Group\Interceptor could not be converted to int in /var/www/html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 3065

The responsible piece of code is somewhere in it

foreach ($stores as $store){
    $storeId = $store->getId();
    $storeCode = $store->getCode();
    if($this->isProStore($storeCode)){
        $storeGroupId = $store->getStoreGroupId();
        $group = $this->groupFactory->create();
        if($storeGroupId !== null){
            $group->load($storeGroupId);
            $group->setRootCategoryId($rootCategoryId);
            $group->save();
            $factoryStore = $this->storeFactory->create();
            $factoryStore->load($storeId);
            $factoryStore->setStoreGroupId($group);
            $factoryStore->save();

        }
    }
}
0

Actually It was just a dumb mistakes I was setting $group instead of $group->getId()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.