Skip to content

Instantly share code, notes, and snippets.

@inri13666
Created September 28, 2016 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inri13666/067dd86e4bd4baa997688439c4a6af04 to your computer and use it in GitHub Desktop.
Save inri13666/067dd86e4bd4baa997688439c4a6af04 to your computer and use it in GitHub Desktop.
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