0
我們有一個用於文章的表格和一個用於文章的區域數據的表格。Kohana 2 ORM: - > with()for has_many relations
class Article_Model extends ORM {
protected $has_many = array('article_translations');
[...]
class Article_Translation_Model extends ORM {
[...]
'articles_translations' 表包含 'article_id的', 'LOCALE_ID', '標題', '體',等。 列。
是否有可能使用Kohana的ORM 2做
SELECT article.id, article_translations.heading, article_translations.body
FROM articles
JOIN articles_translations ON (articles_translations.article_id = article.id)
WHERE articles_translations.locale_id = 'en_US.UTF-8'
?
- > with()構造僅適用於has_one關係。當然,articles_translations.article_id和articles_translations.locale_id是UNIQUE。
OMG,答案是如此簡單。謝謝! – jankkhvej