Skip to content

KNP Translations + Admin = TypeError: ids.map is not a function #148

@ghost

Description

Hello,

I'm just creating an app with Symfony 4 and KNP doctrine extension bundle (DoctrineBehaviorsBundle in model and A2lixTranslationFormBundle in forms) for translations.

React admin works fine for entities without translation, when I try open e.g products with translations I got error:

Uncaught TypeError: ids.map is not a function at getReferencesByIds (oneToMany.js:72) at Function.mapStateToProps [as mapToProps] (ReferenceArrayFieldController.js:103) at mapToPropsProxy (wrapMapToProps.js:43) at Function.detectFactoryAndVerify (wrapMapToProps.js:52) at mapToPropsProxy (wrapMapToProps.js:43) at handleFirstCall (selectorFactory.js:26) at pureFinalPropsSelector (selectorFactory.js:74) at Object.runComponentSelector [as run] (connectAdvanced.js:26) at Connect.initSelector (connectAdvanced.js:178) at new Connect (connectAdvanced.js:119)

Part of products response:
"hydra:member":[ { "@id":"\/app_dev.php\/platform\/api\/products\/1", "@type":"Product", "id":1, "weight":null, "type":1, "size":null, "translations":{ "en-AU":{ "@id":"\/app_dev.php\/platform\/api\/product_translations\/6483", "@type":"ProductTranslation", "id":6483, "locale":"en-AU", "name":"Panam L" } } } ]

I believe that is caused because translations is object (instead array) and keys are language codes. I think react admin should recognize that translations can be an object and it should be properly processed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions