UnderpantsGnomes
UnderpantsGnomes

Reputation: 51

yii2 gridView shows only unique rows

I use related models author and book, and try to show it by gridWiev widget, all is alright, but somehow only unique rows displayed. Despite the query is ok, and return me all rows.

SELECT `book`., `author`. FROM `book` LEFT JOIN `author` ON `book`.`author` = `author`.`id` LIMIT 20

This query return 4 rows, but in gridview only 2, why? I hope someone helps me, thank you in advance.

Code is here https://github.com/underpantsGnomes/test

Upvotes: 2

Views: 561

Answers (1)

UnderpantsGnomes
UnderpantsGnomes

Reputation: 51

It happened becouse column id has the same name. I just rename author.id to author.idAuthor and all worked.

Upvotes: 2

Related Questions