Skip to content

Commit

Permalink
Merge pull request #112 from chives/1.2
Browse files Browse the repository at this point in the history
Do not try to get saved property value when there is none
  • Loading branch information
rn0 authored Jul 10, 2018
2 parents 2990900 + fc98b90 commit 6aa6195
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
"doctrine/orm": "~2.4",
"phpunit/phpunit": "3.7.*"
},
"conflict": {
"phpunit/php-file-iterator": ">=2.0.0"
},
"autoload": {
"psr-4": {
"FSi\\DoctrineExtensions\\": "lib/FSi/DoctrineExtensions/"
Expand Down
8 changes: 4 additions & 4 deletions lib/FSi/DoctrineExtensions/Uploadable/UploadableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,10 @@ protected function updateFiles(ObjectManager $objectManager, $uploadableMeta, $o
$filesystem = $this->computeFilesystem($config);

// Since file has changed, the old one should be removed.
if ($oldKey = $accessor->getValue($object, $property)) {
if ($oldFile = $propertyObserver->getSavedValue($object, $config['targetField'])) {
$this->addToDelete($oldFile);
}
if ($accessor->getValue($object, $property)
&& $propertyObserver->hasSavedValue($object, $config['targetField'])
&& $oldFile = $propertyObserver->getSavedValue($object, $config['targetField'])) {
$this->addToDelete($oldFile);
}

if (empty($file)) {
Expand Down

0 comments on commit 6aa6195

Please sign in to comment.