Closed piotrostrowski closed 3 years ago
You can use alias feature to prevent the conflict right now.
[
'artworks.id',
'artworks.created_at',
'artworks.modified_at',
'author' => [
'author.id(author_id)',
'author.name',
'author.created_at(author_create)',
'author.modified_at(author_modified)'
]
]
if don't use the data mapping, it is still require you to use the alias to identify the conflicted column.
[
'artworks.id',
'artworks.created_at',
'artworks.modified_at',
'author.id(author_id)',
'author.name',
'author.created_at(author_create)',
'author.modified_at(author_modified)'
]
But it will be a little bit complex to handle this without using the alias, because Medoo is using PDO::FETCH_ASSOC
to fetch the data, it can be improve for it in the further.
Thanks @catfan for the reply! Unfortunately aliases does not work within those internal mappings. Following piece of code results in:
NOTICE: Undefined index: id(author_id)
@piotrostrowski Well, it is a bug. We missed handle the alias for internal mapping. And we fixed it now.
really need a solution without the alias
Hello, I have encountered an issue while using the new mapping function. Whenever there is a joining table with same column names medoo will put null values into those fields. Example:
Is there any way to avoid this issue?