Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefixed resource generates wrong format options list #249

Open
armellarcier opened this issue Mar 1, 2021 · 1 comment
Open

Prefixed resource generates wrong format options list #249

armellarcier opened this issue Mar 1, 2021 · 1 comment

Comments

@armellarcier
Copy link

In order to get an import form displayed I have type the tag with the full, prefixed resource name.

    sylius.importer.my_plugin.my_resource.xlsx:
        class: FriendsOfSylius\SyliusImportExportPlugin\Importer\ResourceImporter
        arguments:
            - "@app.factory.my_resource.spreadsheet_reader"
            - "@my_plugin.manager.my_resource"
            - "@app.processor.my_plugin.my_resource"
            - "@sylius.importer.result"
            - 100
            - false
            - false
        tags:
            - { name: sylius.importer, type: my_plugin.my_resource, format: xlsx }

But when it comes to generating the list of format options, in src/Form/ImportType.php's buildChoices method, the importer_type option is set to the request's resource name, which is not prefixed.

So ImporterRegistry::buildServiceName($importerType, 'xlsx') (in my case) returns "my_resource.xlsx" which is not registered in the ImporterRegistry since the service name is built with the "my_plugin" prefix.

I end up with only the JSON option.

@cdarken
Copy link
Contributor

cdarken commented Nov 16, 2021

I confirm this.
The cause seems to be the matching in the ImportDataController, line 49. The 'app' part is lost, the route only has the resource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants