【发布时间】:2011-10-04 17:30:16
【问题描述】:
class Model_Category extends ORM
{
protected $_has_many = array(
'film' => array('through' => 'films_categories')
);
}
class Model_Film extends ORM
{
protected $_has_many = array(
'categories' => array(
'through' => 'films_categories'
),
}
films
-id (pk)
-title
-description
categories
-id (pk)
-name
films_categories
-film_id
-category_id
这是我的表格的外观,这是我需要做的:
$films->ORM::factory('film');
$films
->where('title', '=', $my_title)
->and_where('any of categories name', '=', $category_name)
->find_all();
我需要找到包含 $my_category='any of category from category table' 的记录。有什么简单的方法吗?
【问题讨论】:
标签: php kohana kohana-3 kohana-orm