Skip to content

Support Autowiring Filesystems #276

@mvhirsch

Description

@mvhirsch

I'm trying to use Symfony's autowiring like this:

# knp_gaufrette.yaml
knp_gaufrette:
    filesystems:
        import: { adapter: import }
<?php

namespace App\Command;

use Gaufrette\FilesystemInterface;

final class MyCommand
{
    public function __construct(FilesytemInterface $importFilesystem) 
    {

    }
}

But it results in an error:

Cannot autowire service "App\Command\MyCommand": argument "$importFilesystem" of method "__construct()" references interface "Gaufrette\FilesystemInterface" but no such service exists. You should maybe alias this interface to one of these existing services: "sonata.media.filesystem.s3", "gaufrette.import_filesytem", ...

Seems like there is no support for this like MonologBundle does?

Would it be possible to add aliases so this will be possible? I'm using 0.7.1 (as I cannot upgrade to PHP 8 by now). Could this change be backported to 0.7.x, too?

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions