You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If using StoreAsPath and all your filename prefixes are the same (ie some/dir/filename.ext) it can be a waste of resources to store the same prefix in the db over and over.
I propose a StoreAsFilename mapping:
#[StoreAsFilename(
filesystem: 'public'
fileNamer: newExpression('{this.title|slug}-{name}{ext}'), // would throw an exception if contains /'s
directoryNamer: newExpression('some/dir'),
)]
private File $file;
When saving to db, just the filename would be stored. When loading, the directoryNamer would be used to create the prefix and append the filename to it.
As a slight perf boost, we could add a StringNamer that doesn't require processing and just returns the string. Probably a SelfGeneratingNamer concept should be added.
If using
StoreAsPath
and all your filename prefixes are the same (iesome/dir/filename.ext
) it can be a waste of resources to store the same prefix in the db over and over.I propose a
StoreAsFilename
mapping:When saving to db, just the filename would be stored. When loading, the
directoryNamer
would be used to create the prefix and append the filename to it.As a slight perf boost, we could add a
String
Namer that doesn't require processing and just returns the string. Probably aSelfGeneratingNamer
concept should be added.The text was updated successfully, but these errors were encountered: