Is there a way of getting the Doctrine Uploadable extension to store a path relative to a directory in the database?
We use Capistrano to manage releases on our servers, so when a file is uploaded, the stored path looks like: /var/www/sitename/releases/20140625151300/web/uploads/$filename. While the files themselves are safe (uploads is a symlink), when the release is deleted the paths necome broken.
For example, the stored path could just be the filename or relative to %kernel.root_dir%.
I had the same problem and rather than dig into the listener (which I assume would be the other possibility) I set the path in my parameters file and then referenced that parameter in the
stof_doctrine_extensionssection. This way it allowed me to have the real path but allow it to be different for each version.In
app/config/parameters.ymlIn
app/config/config.ymlIf you're not using the
stofbundle then I assume you would just pass the parameter into your listener as one of thecalls.Like I say though, I'm pretty sure you would be able to go into the listener and play with that but I found this the easiest approach.