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();
}
}
}