1

I've upgraded my symfony projet version from 3.3 to 3.4 a few month ago and everything woked find but i recently tried to ad an event listener and then i've got that error

The configuration key "public" cannot be used to define a default value in "/home/pc-dev/Labs/Projets-jebuy/je-buy.com/app/config/services.yml". Allowed keys are "private", "tags", "autowire", "autoconfigure", "bind" in /home  
  /pc-dev/Labs/Projets-jebuy/je-buy.com/app/config/services.yml (which is being imported from "/home/pc-dev/Labs/Projets-jebuy/je-buy.com/app/config/config.yml"). 

obviuosly nothing seriuos i edited the default service.yml file from this

    # default configuration for services in *this* file
    _defaults:
        # automatically injects dependencies in your services
        autowire: true
        # automatically registers your services as commands, event subscribers, etc.
        autoconfigure: true
        # this means you cannot fetch services directly from the container via $container->get()
        # if you need to do this, you can override this setting on individual services
        public: false
    twig.extension:
        class: AppBundle\Twig\Extension\MenuExtension
        arguments:
            - '@doctrine'
        tags:
            - {name : twig.extension }
#    service.extension:
#        class: AdminBundle\DependencyInjection\AdminExtension
#        arguments: []
#        tags: []

to this (because in symfony 3.4 or 4, all services are by default private)

services:
    # default configuration for services in *this* file
    _defaults:
        # automatically injects dependencies in your services
        autowire: true
        # automatically registers your services as commands, event subscribers, etc.
        autoconfigure: true
        # this means you cannot fetch services directly from the container via $container->get()
        # if you need to do this, you can override this setting on individual services
        private: true
    twig.extension:
        class: AppBundle\Twig\Extension\MenuExtension
        arguments:
            - '@doctrine'
        tags:
            - {name : twig.extension }
#    service.extension:
#        class: AdminBundle\DependencyInjection\AdminExtension
#        arguments: []
#        tags: []

but when i tried to run the server i've now got this error

 The service "templating.loader.cache" has a dependency on a non-existent service "templating.loader.wrapped".

and i don't now how to solve it and where is that template.loder.wrapped service.

je-buy 01
  • 35
  • 8
  • have you tried skipping `private:true` config. As services are private by default. May be this configuration is overriding the default `template.loder.wrapped` scope. – Kamran Mar 03 '20 at 12:21
  • yes I started with skipping this given that the services are private by default but I still have the same error – je-buy 01 Mar 03 '20 at 12:47
  • try making `templating.loader.wrapped` public. I have checked the container the service class is `Symfony\Component\Templating\Loader\CacheLoader` – Kamran Mar 03 '20 at 13:55
  • I don't find the templating.loader.wrapped service I found it class but not the service can you please tell me where to find it I'm using Symfony 3.4 – je-buy 01 Mar 03 '20 at 14:19
  • if you have not yet resolved look this: https://symfony.com/doc/3.4/setup/upgrade_minor.html – Nobady Mar 04 '20 at 16:12
  • thank you, Nobady I solve the problem with the link – je-buy 01 Mar 09 '20 at 15:19

0 Answers0