Skip to content

Commit

Permalink
Improve empty property check
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Hoffmann committed Mar 6, 2017
1 parent fbdb8bc commit 094c2a2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/ORM/Behavior/TranslateBehavior.php
Expand Up @@ -658,12 +658,11 @@ protected function _unsetEmptyFields(EntityInterface $entity)
}
}

// Workaround to check the remaining properties
$arrayEntity = $entity->toArray();
$translation = $translation->extract($this->_config['fields']);

// If now, the current locale property is empty,
// unset it completely.
if (empty($arrayEntity['_translations'][$locale])) {
if (empty(array_filter($translation))) {
unset($entity->get('_translations')[$locale]);
}
}
Expand Down

0 comments on commit 094c2a2

Please sign in to comment.