Skip to content

Commit

Permalink
[Translatable] Do not persist new translations if empty
Browse files Browse the repository at this point in the history
Do not persist new translations if empty
  • Loading branch information
giuliapellegrini committed Oct 27, 2017
1 parent d27e25f commit efb6c24
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Model/Translatable/TranslatableMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected function doTranslate($locale = null, $fallbackToDefault = true)
public function mergeNewTranslations()
{
foreach ($this->getNewTranslations() as $newTranslation) {
if (!$this->getTranslations()->contains($newTranslation)) {
if (!$this->getTranslations()->contains($newTranslation) && !$newTranslation->isEmpty()) {
$this->addTranslation($newTranslation);
$this->getNewTranslations()->removeElement($newTranslation);
}
Expand Down Expand Up @@ -171,10 +171,10 @@ public function getDefaultLocale()

/**
* An extra feature allows you to proxy translated fields of a translatable entity.
*
*
* @param string $method
* @param array $arguments
*
*
* @return mixed The translated value of the field for current locale
*/
protected function proxyCurrentLocaleTranslation($method, array $arguments = [])
Expand Down

0 comments on commit efb6c24

Please sign in to comment.