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

Document how to share filter sets with multiple data loaders #1613

Open
tacman opened this issue Dec 7, 2024 · 1 comment
Open

Document how to share filter sets with multiple data loaders #1613

tacman opened this issue Dec 7, 2024 · 1 comment

Comments

@tacman
Copy link
Contributor

tacman commented Dec 7, 2024

I have several data loaders in flysystem. In the liip configuration, I can either set the default data loader for all filter sets, OR set a data loader within each filterset.

But I want to apply the same filter to multiple sets.

    loaders:
        flysystem_loader:
            flysystem:
                # this comes from flysystem.yaml
                filesystem_service: default.storage

    # default loader to use for all filter sets
    data_loader: flysystem_loader
    filter_sets:
        auto_rotate: ~
        large_s3:
            data_loader: s3.storage
            filters:
                thumbnail:
                    size:          [400, 400]
                    allow_upscale: true
                    mode: inset
        large:
            filters:
                thumbnail:
                    size:          [400, 400]
                    allow_upscale: true
                    mode: inset

in flysystem

flysystem:
    storages:
        default.storage:
            adapter: 'local'
            options:
                directory: '%kernel.project_dir%/src'
        uploads.storage:
            adapter: 'local'
            options:
                 directory: '%kernel.project_dir%/private/uploads'
        s3.storage:
            adapter: 'aws'
            options:
                client: 'Aws\S3\S3Client' # The service ID of the Aws\S3\S3Client instance,
                bucket: '%env(AWS_S3_BUCKET_NAME)%'
                streamReads: true
                prefix: '%env(S3_STORAGE_PREFIX)%'

I know which flysystemOperator I have, I want to pass it into the imagine_filter filter in twig, and the cache->getBrowserPath() method in php, but there seems to be no way to indicate which datasource.

I see I can use a chain loader, but that could get expensive if I have multiple could-based loaders and it has to loop through them to find the right one.

Thoughts on how this might be done?

@dbu
Copy link
Member

dbu commented Dec 9, 2024

i think you could use yaml overrides, see for example https://www.linode.com/docs/guides/yaml-anchors-aliases-overrides-extensions/#yaml-overrides . its basically a copy-paste instruction for the yaml parser. symfony supports this feature.

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