How to organize the output field if it is in another table?

Hello.

There is a table of reviews, it contains in addition to the thematic fields(comment, rating) field user_id. But on the front-end output the user_id will be inconvenient for users, and I would like to display the user name.

But to get the name of the user is to each opinion need to +1 the request by receiving user information by id. Thus on 5 opinions +5 queries. I think it's not the best option. There is the idea to keep a copy of the user name in the feedback table, but is it right?

What option is correct in this situation, requests, or storing a copy of user name? Or is there any other correct options?

Thanks for the replies.
June 14th 19 at 20:36
3 answers
June 14th 19 at 20:38
Or is there any other correct options?
LEFT JOIN?
June 14th 19 at 20:40
What you're looking for is called relational data:
www.yiiframework.com/doc-2.0/guide-db-active-recor...
June 14th 19 at 20:42
as said to start, set up communiques. Then just implement eager loading , and regardless of the number of records You will always have 1-2 query

Find more questions by tags PHPMySQLYii