artgris / FileManagerBundle

FileManager is a simple Multilingual File Manager Bundle for Symfony
MIT License
171 stars 89 forks source link

CustomConfService doesn't work in Symfony 4 #42

Closed akerbel closed 5 years ago

akerbel commented 5 years ago

I am trying to create a custom config in Symfony 4 and got an error: "The "file_manager_configuration" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.".

I made a little research and found this line in your code: $conf = $this->get($managerConf[$conf]['service'])->getConf($extra); How I understood we are not allowed to get services right from container and must use dependency injection in Symfony 4. Here is the same issue in another bundle with solution example: https://github.com/liip/LiipImagineBundle/issues/1033

akerbel commented 5 years ago

Update: it shoulnd't work even in Symfony 3.4 https://symfony.com/blog/new-in-symfony-3-4-services-are-private-by-default

akerbel commented 5 years ago

Ok, fast solution is to make the service public:

    file_manager_configuration:
          class: App\Service\FileManagerConfiguration
          public: true