Skip to content

Conversation

oliverstasa
Copy link
Member

in case of multilangual inputs, parse array in input to json string:
input :
{"description": {"en": "test1", "cz": "test1"} }
===>
db output:
"description": "{"en":"test1","cz":"test1"}"

@oliverstasa oliverstasa requested a review from pchalupa as a code owner May 19, 2021 12:39
@oliverstasa
Copy link
Member Author

i don't get it ==> phpstan says its always true but it isn't, it works when tested

return array_key_exists($key, $this->body) ? $this->body[$key] : $default;
// return array_key_exists($key, $this->body) ? json_encode($this->body[$key]) : $default;
if (array_key_exists($key, $this->body)) {
if (is_string($this->body[$key])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.body is array of strings, so it will always be string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants