did you try this? I think this is the answer
foreach($users as $u) {
echo $u->id;
echo $u->profiles->full_name;
}
Вопрос
This is the structure of User table
id
role_id
username
and this is the structure of Profile table
id
user_id
full_name
I want to join the two and display the full_name of users who have role_id = n
$users = ORM::factory("User")->join("profiles", "INNER")->on("user.id", "=", "profiles.user_id")->find_all();
In the view I do this
foreach($users as $u) {
echo $u->id;
echo $u->full_name;
}
But kohana says
*full_name*
does not exists in the
*Model_User*
this means the join is not going on. Why ?
Another think, how can I label the query so that echo $u->id displays the User.id ? Because here User.id and Profile.id make things be ambigouos.
Нет правильного решения
Другие советы
did you try this? I think this is the answer
foreach($users as $u) {
echo $u->id;
echo $u->profiles->full_name;
}