title: Yii2 load attribute of a referenced table
body: <p>I'm working with Yii2 to create an application. Consider a model A that has an attribute with an external reference to another model B (both of them have DB tables) by id. When I populate the view of the model A I need to show an attribute of the object B referenced which is not the id. By now I create a variable in the model A that is populated during the afterFind() by querying the db for the attribute relative to the id of the model B. Is there a better way to solve this problem that does not require to use afterFinds or more variables? Can you provide an example?</p>