So I have a very simple service for now. This is my services.yaml:
# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters:
imports:
- resource: myservice.yaml
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
and the file myservice.yaml is:
services:
service.http_client:
class: GuzzleHttp\Client
public: true
arguments:
-
timeout: 2.0
base_uri: "%env(BASE_URI)%"
handler: GuzzleHttp\HandlerStack
headers:
X-Api-Key: "%env(API_KEY)%"
service.service_client:
class: Service\V1alpha\ServiceClient
arguments:
- '%env(BASE_URI)%'
- '@deeplink.http_client'
- ~
- ~
- ''
service:
class: App\Service\Service
public: true
arguments:
- "@service.service_client"
when I try to use it in my Controller like:
public function __construct(private readonly Service $deeplinkService)
{}
It constantly fails saying that Service\V1alpha\ServiceClient
no such service exists. So this service clearly exists in ma vendor
folder and the namespace is correct. What is the issue with autowiring here?