I am trying to organize the configuration of the services in several YAML files, but this is giving me an error.
This is my services.yml :
imports:
- { resource: services_ext.yml }
# Learn more about services, parameters and containers at
# https://symfony.com/doc/current/service_container.html
parameters:
#parameter_name: value
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
# makes classes in src/AppBundle available to be used as services
# this creates a service per class whose id is the fully-qualified class name
AppBundle\:
resource: '../../src/AppBundle/*'
# you can exclude directories or files
# but if a service is unused, it's removed anyway
exclude: '../../src/AppBundle/{Entity,Repository,Tests}'
# controllers are imported separately to make sure they're public
# and have a tag that allows actions to type-hint services
AppBundle\Controller\:
resource: '../../src/AppBundle/Controller'
public: true
tags: ['controller.service_arguments']
And this my services_ext.yml :
parameters:
# Parametros
services:
_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
AppBundle\Service\ClaseServicio:
public: true
arguments:
$doctrine: '@doctrine'
$cmdf: '@Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface'
With this configuration I get the error:
\ "AppBundle \ Service \ ServiceClass \" 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.
On the other hand, if I set the ServiceClass configuration to services.yml , it works perfectly.
What am I doing wrong?
Edit: The symfony version is 3.4