tzunghaor / settings-bundle

Symfony bundle for storing settings in database with editor GUI
MIT License
4 stars 1 forks source link

Argument $scopeProvider must be of type ScopeProviderInterface #1

Closed czachor closed 2 years ago

czachor commented 2 years ago

Same config as provided in readme. Symfony 5.3, PHP 8.0.9, cache cleared. Bundle cache disabled. DB table created succesfully, route, classes etc. set, but /settings/edit throws an exception:

TypeError {#6623
  #message: "Tzunghaor\SettingsBundle\Service\SettingsMetaService::__construct(): Argument #3 ($scopeProvider) must be of type Tzunghaor\SettingsBundle\Service\ScopeProviderInterface, string given, called in E:\foo-project\var\cache\dev\ContainerAt4BElb\getTzunghaorSettings_SettingsMetaSe
rviceService.php on line 24"
  #code: 0
  #file: "E:\foo-project\vendor\tzunghaor\settings-bundle\Service\SettingsMetaService.php"
  #line: 54
  trace: {
    E:\foo-project\vendor\tzunghaor\settings-bundle\Service\SettingsMetaService.php:54 { …}
    E:\foo-project\var\cache\dev\ContainerAt4BElb\getTzunghaorSettings_SettingsMetaServiceService.php:24 {
      ContainerAt4BElb\getTzunghaorSettings_SettingsMetaServiceService::do($container, $lazyLoad = true)
      › 
      ›     return $container->privates['tzunghaor_settings.settings_meta_service'] = new \Tzunghaor\SettingsBundle\Service\SettingsMetaService(($container->privates['tzunghaor_settings.default_cache'] ?? ($container->privates['tzunghaor_settings.default_cache'] = new \Symfony\Component\Cache\Adapter\ArrayAdapt
er())), new \Tzunghaor\SettingsBundle\Service\MetaDataExtractor(($container->privates['annotations.cached_reader'] ?? $container->getAnnotations_CachedReaderService()), ($container->privates['property_info'] ?? $container->getPropertyInfoService())), '@tzunghaor_settings.default_scope_provider', 'default', ['Bo
xSettings' => 'App\\Settings\\BoxSettings'], NULL, []);
      › }
      arguments: {
        $cache: Symfony\Component\Cache\Adapter\ArrayAdapter {#10263 …}
        $metaDataExtractor: Tzunghaor\SettingsBundle\Service\MetaDataExtractor {#8598 …}
        $scopeProvider: "@tzunghaor_settings.default_scope_provider"
        $collectionName: "default"
        $sectionClasses: array:1 [ …1]
        $collectionTitle: null
        $collectionExtra: []
      }
    }
    E:\foo-project\var\cache\dev\ContainerAt4BElb\App_KernelDevDebugContainer.php:718 { …}
    E:\foo-project\var\cache\dev\ContainerAt4BElb\getCacheWarmerService.php:35 { …}
    E:\foo-project\vendor\symfony\http-kernel\CacheWarmer\CacheWarmerAggregate.php:90 { …}
    E:\foo-project\vendor\symfony\http-kernel\Kernel.php:584 { …}
    E:\foo-project\vendor\symfony\http-kernel\Kernel.php:786 { …}
    E:\foo-project\vendor\symfony\http-kernel\Kernel.php:125 { …}
    E:\foo-project\vendor\symfony\framework-bundle\Console\Application.php:168 { …}
    E:\foo-project\vendor\symfony\framework-bundle\Console\Application.php:74 { …}
    E:\foo-project\vendor\symfony\console\Application.php:167 { …}
    E:\foo-project\vendor\symfony\runtime\Runner\Symfony\ConsoleApplicationRunner.php:56 { …}
    E:\foo-project\vendor\autoload_runtime.php:35 { …}
    E:\foo-project\bin\console:11 { …}
  }
}
tzunghaor commented 2 years ago

Thank you for the report.

Please post your complete config/packages/tzunghaor_config.yaml

The only way I can get this error is when neither "scopes" nor "scope_provider" is defined in config. In this case it would make sense that I provide some default behaviour or show a better error message.

tzunghaor commented 2 years ago

It seems I've already prepared for the case of having neither "scopes" nor "scope_provider", but I've messed up the config. Fixed it in release 0.11.2, please check if it solves your problem. If not, then please post your config/packages/tzunghaor_config.yaml

czachor commented 2 years ago

Hello, thanks, 0.11.2 solved the issue.