Yii - get a few models at one's

Hi, please help me to get information from a few models, lets say i wan’t to show in one grid users personal information and also show his last post or all posts.

 $grid = new GridConnector(User::model(),"PHPYii");
 $grid->configure("-", "user_id", "name, age, city,email,phone");
 $grid->render();
  • in this case work’s ok but it just “findall()” from “User” model ant i need to get data from a few models.

It is possible to provide a result of custom find call instead of model ( so it not limited to findAll )
But in your case, as you need to fetch data from multiple collections, it will not work anyway.

You can use YII code to collect the array of necessary data and output it by using render_array

$grid = new GridConnector("dummy"); $grid->render_array($data, "user_id", "name, age, city,email,phone");

Thanks, i will try it now but what should i put here
$grid = new GridConnector(“dummy”);
because as i know GridConnector() must get some connection as parameter.

When you are using render_array - connector will work with provided array of data, so it doesn’t need a real connection, any not null value will work ( the “dummy” string from above sample will work )