-
Notifications
You must be signed in to change notification settings - Fork 40
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
Changing Media entity twice in same request is trying to delete directory #141
Comments
generally doing things in doctrine event listeners can be tricky. do you see a way to do it with a custom symfony event? otherwise, if you see a way how this could properly work, please do a bugfix pull request. |
Aaaaargh, posted to the wrong place. The issue I have is with Sonata and not Symfony CMF directly. Hangs head in shame... |
I think that could be related: doctrine/phpcr-odm#661 Can you try that branch of phpcr-odm to find out whether this still happens? |
@uwej711 No, don't think it's related. I posted to the wrong place, we're using the Sonata Media bundle and regular doctrine entities, not Symfony-CMF/phpcr. |
OK, you are right. |
We have a situation where we create a Media entity using a dummy file, then after we have saved it (and can get a provider reference for where the image is stored) we set the file size etc. When we make the second change the postUpdate doctrine lifecycle event is trying to delete the whole directory.
Our code in question:
On the second flush, the code in \Sonata\MediaBundle\Provider\FileProvider::postUpdate is deleting the current file from the filesystem using $media->getPreviousProviderReference() which is null.
Is this a bug?
The text was updated successfully, but these errors were encountered: