Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swisscomeventandmedia sync #10

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -190,12 +190,14 @@ public function setTranslations(array $translations) {
$repository = $this->entityManager->getRepository('Gedmo\\Translatable\\Entity\\Translation');

foreach ($translations as $language => $properties) {
foreach ($properties as $propertyName => $translatedValue) {
$meta = $this->entityManager->getClassMetadata(get_class($this));
// $locale class property overwrites the translatable listener (for some reasons, this is not always the same)
$locale = $this->locale ?? $this->translatableListener->getTranslatableLocale($this, $meta, $this->entityManager);
foreach ($properties as $propertyName => $translatedValue) {
/* Do not store empty translations since gedmo extension's behaviour has changed in
https://github.com/Atlantic18/DoctrineExtensions/commit/6cc9fb3864a2562806d8a66276196825e3181c49 */
if ($translatedValue) {
$meta = $this->entityManager->getClassMetadata(get_class($this));
if ($language === $this->translatableListener->getTranslatableLocale($this, $meta, $this->entityManager)) {
if ($language === $locale) {
/* Do not translate the default language by the repository. The repository->translate() does the
same, but also persists the object ($this). However, persisting the object should not be handled
withing this setter.
Expand Down
4 changes: 2 additions & 2 deletions Configuration/Settings.yaml
Expand Up @@ -8,9 +8,9 @@ Sandstorm:
Neos:
Flow:
object:
excludeClasses:
includeClasses:
gedmo.doctrineextensions:
- 'Gedmo\\.*'
- 'Gedmo\\Translatable\\Entity'
persistence:
doctrine:
eventListeners:
Expand Down