Locastic / ApiPlatformTranslationBundle

Translation bundle for ApiPlatform based on Sylius translation
MIT License
85 stars 28 forks source link

inconsistency of returning types #42

Closed yalagin closed 3 years ago

yalagin commented 3 years ago

there is an inconsistency of returning types when translation is empty it's returning array instead of object

no translations

{
"id":1,
 "translations": []
}

there are translations

{
"id":1,
 "translations": { 
        "en":{
            "title":"test",
            "content":"test",
            "locale":"en"
        },
        "de":{
            "title":"test de",
            "content":"test de",
            "locale":"de"
        }
    }
}

maybe it's should return {} or null if there are no translations

yalagin commented 3 years ago

well, I took a look at why it's serializing an array. it's because of https://github.com/symfony/symfony/issues/37061 and https://github.com/symfony/symfony/pull/37049

paullla commented 3 years ago

@yalagin thank you for reporting. I'm closing it since it's Symfony issue