Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #216 from davidyell/develop
Browse files Browse the repository at this point in the history
Merge for release
  • Loading branch information
davidyell authored Jan 24, 2017
2 parents d27a80c + e90bb1a commit 55237d5
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/Model/Behavior/ProfferBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $opti
*/
public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $options, ProfferPathInterface $path = null)
{

foreach ($this->config() as $field => $settings) {
$tableEntityClass = $this->_table->entityClass();

Expand Down Expand Up @@ -115,9 +116,10 @@ public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $o
protected function process($field, array $settings, EntityInterface $entity, ProfferPathInterface $path = null)
{
$path = $this->createPath($entity, $field, $settings, $path);
$tableEntityClass = $this->_table->entityClass();

if ($tableEntityClass !== null && $entity instanceof $tableEntityClass) {
if (is_array($entity->get($field)) && count(array_filter(array_keys($entity->get($field)), 'is_string')) > 0) {
$uploadList = [$entity->get($field)];
} else {
$uploadList = [
[
'name' => $entity->get('name'),
Expand All @@ -127,11 +129,6 @@ protected function process($field, array $settings, EntityInterface $entity, Pro
'size' => $entity->get('size'),
]
];
} else {
$uploadList = $entity->get($field);
if (count(array_filter(array_keys($entity->get($field)), 'is_string')) > 0) {
$uploadList = [$entity->get($field)];
}
}

foreach ($uploadList as $upload) {
Expand Down

0 comments on commit 55237d5

Please sign in to comment.