Created
September 28, 2016 14:04
-
-
Save inri13666/067dd86e4bd4baa997688439c4a6af04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function saveValue($key, $value, $locale, $domain = self::DEFAULT_DOMAIN, $scope = Translation::SCOPE_SYSTEM) | |
{ | |
$translationValue = $this->findValue($key, $locale, $domain); | |
if (!$this->canUpdateTranslation($scope, $translationValue)) { | |
return null; | |
} | |
if (!$value && $translationValue) { | |
$this->getEntityManager(Translation::class)->remove($translationValue); | |
return null; | |
} | |
if (null === $translationValue) { | |
$translationValue = $this->createValue($key, $value, $locale, $domain, true); | |
} | |
$translationValue->setValue($value); | |
$translationValue->setScope($scope); | |
return $translationValue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment