问题
I made a composer update and I get the following error:
Cannot autowire service "App\Controller\Modules\myapp\myappController": argument "$mySystem" of method "__construct()" references interface "League\Flysystem\FilesystemInterface" but no such service exists. Did you create a class that implements this interface?
Before the composer update, everything worked fine.
service.yaml:
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
myapp:
fields: ['parentfolder', 'files', 'valid_until', 'ip_location']
templates: ['files']
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.
public: false # Allows optimizing the container by removing unused services; this also means
# fetching services directly from the container via $container->get() won't work.
# The best practice is to be explicit about your dependencies anyway.
# makes classes in src/ available to be used as services
App\:
resource: '../src/*'
exclude: '../src/{Entity,Migrations,Tests,Helper,Kernel.php}'
App\Controller\:
resource: '../src/Controller'
tags: ['controller.service_arguments']
# ...
App\Controller\Modules\myapp\myappController:
class: App\Controller\Modules\myapp\myappController
arguments: ['%myapp%']
回答1:
It would help to also share the controller code in question, but from your other question it seems you have tried to use OneupUploaderBundle and it requires to define a service for a namer. https://github.com/1up-lab/OneupUploaderBundle/blob/master/Resources/doc/custom_namer.md
Please check above how services are defined with that bundle and check its remaining documentation. Seems like you didn't provide a service you're trying to use in your controller and that's the problem. If that doesn't solve the problem, feel free to share more code and we'll see what's next.
来源:https://stackoverflow.com/questions/59577020/how-can-i-restore-a-service-after-composer-update-in-symfony