Skip to content

add ChainDirectoryNamer directory namer#1570

Merged
garak merged 1 commit intodustin10:3.xfrom
guillaume-sainthillier:fix-configurable-namers
Jan 24, 2026
Merged

add ChainDirectoryNamer directory namer#1570
garak merged 1 commit intodustin10:3.xfrom
guillaume-sainthillier:fix-configurable-namers

Conversation

@guillaume-sainthillier
Copy link
Contributor

This PR adds a chainable directory namer

@garak
Copy link
Collaborator

garak commented Jan 16, 2026

Please target branch 3.x for new features

@guillaume-sainthillier guillaume-sainthillier changed the base branch from master to 3.x January 16, 2026 15:39
@guillaume-sainthillier guillaume-sainthillier force-pushed the fix-configurable-namers branch 2 times, most recently from 84f8a4f to e9a35ed Compare January 16, 2026 15:45
@guillaume-sainthillier
Copy link
Contributor Author

@garak done :)

@garak
Copy link
Collaborator

garak commented Jan 17, 2026

What about simple namers? Do you plan to open a PR for that too?

@guillaume-sainthillier
Copy link
Contributor Author

guillaume-sainthillier commented Jan 17, 2026

@garak we can add a file namer if it make sens, IMO I don't really see the use case but why not.
For the chain directory name we can also add a way to use it by using a directory_namers config instead of my actual implementation, like this :

vich_uploader:
    # ...
    mappings:
        products:
            upload_destination: products
            directory_namers:
                # Order matter
                services: 
                    - service: vich_uploader.namer_directory_configurable
                      options:
                          directory_path: 'folder/subfolder/subsubfolder'
                    - service: Vich\UploaderBundle\Naming\PropertyDirectoryNamer
                      options:
                            property: category.slug
                    # Service ID directely
                    - 'my.directory_namer.product'
                  # Options for the ChainDirectoryNamer
                  options:  
                      separator: '/'  # optional, defaults to '/'

@guillaume-sainthillier
Copy link
Contributor Author

@garak maybe the introduction of a new directory_namers would be cleaner than my actual implementation, what do you think?

@garak garak merged commit 4b9e846 into dustin10:3.x Jan 24, 2026
11 checks passed
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

Successfully merging this pull request may close these issues.

2 participants