У меня есть отношение, настроенное так:
class Geocache extends AppModel {
var $belongsTo = 'User';
var $hasMany = 'Log';
}
class Log extends AppModel {
var $belongsTo = array('User','Geocache');
}
class User extends AppModel {
var $hasMany = array('Geocache','Log');
}
и $this->Geocache->find('first');
возвращает:
Array
(
[Geocache] => Array
(
[id] => 86
[user_id] => 3
[name] => Hejssa
//...
)
[User] => Array
(
[id] => 3
[username] => Ahtenus
//...
)
[Log] => Array
(
[0] => Array
(
[id] => 1
[user_id] => 12
// How do i retrive the username and such from the User table together with this?
[geocache_id] => 86
//...
)
//...
)
)
Как я также могу получить данные пользователя для каждого журнала?