Skip to content

Commit

Permalink
Merge pull request #350 from simkimsia/patch-3
Browse files Browse the repository at this point in the history
Call the $path->basepath() function once
  • Loading branch information
josegonzalez committed Jan 16, 2016
2 parents accb7a0 + b8467a0 commit 39e93da
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Model/Behavior/UploadBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public function beforeSave(Event $event, Entity $entity, ArrayObject $options)

$data = $entity->get($field);
$path = $this->getPathProcessor($entity, $data, $field, $settings);
$files = $this->constructFiles($entity, $data, $field, $settings, $path->basepath());
$basepath = $path->basepath();
$files = $this->constructFiles($entity, $data, $field, $settings, $basepath);

$writer = $this->getWriter($entity, $data, $field, $settings);
$success = $writer->write($files);
Expand All @@ -86,7 +87,7 @@ public function beforeSave(Event $event, Entity $entity, ArrayObject $options)
}

$entity->set($field, $path->filename());
$entity->set(Hash::get($settings, 'fields.dir', 'dir'), $path->basepath());
$entity->set(Hash::get($settings, 'fields.dir', 'dir'), $basepath);
$entity->set(Hash::get($settings, 'fields.size', 'size'), $data['size']);
$entity->set(Hash::get($settings, 'fields.type', 'type'), $data['type']);
}
Expand Down

0 comments on commit 39e93da

Please sign in to comment.