0
我有在Kohana的ORM的關係問題。我有三種模式:用戶,歌曲和標籤。如何實現多關係ORM在Kohana的?
User {
has many Songs;
has many Tags; (followed tags)
}
Song {
belongs to User;
has many Tags;
}
Tag {
has many Users;
has many Songs;
}
實施例:
- 用戶 'Naimad' 被以下標記:Deadmau5和Inpetto。
- 每個標籤有兩首歌曲:
- Deadmau5標籤有:大草原和頻閃燈,
- Inpetto標籤有:託卡的奇蹟和風暴。
我想從標籤,然後用戶獲得這些歌曲,我不知道如何做到這一點。我知道這是愚蠢的例子,但我想之前我張貼了這個問題:
$songs = ORM::factory('user', array('name' => 'Naimad'))
->tags
->songs
->find_all();