Symfony 3 - You have requested a non-existent service is driving me crazy

You wrote:

Steps I took to ensure service is properly setup

My AppBundleExtension.php

And:

I know AppBundleExtension is not loading, what do I need to do to load it? What am I missing?

So it was clear that the AppBundleExtension class was not loaded.

According to the official documentation you should remove the Bundle in the file name and class name:

The name is equal to the bundle name with the Bundle suffix replaced by Extension (e.g. the Extension class of the AppBundle would be called AppExtension and the one for AcmeHelloBundle would be called AcmeHelloExtension).


The reason why I kept getting this error was that my default setting for services was public: false

So to fix that I needed to set the public property to true for my service

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
        public: false

    my_service:
        class: AppBundle\Service\MyService
        public: true

You can update your config.yml file:

imports: 
      - { resource: "@AppBundle/Resources/config/services.yml" }

Tags:

Php

Symfony