Thành Long Nguyễn Thu Dec 27 10:36:25 -0500 2012

Subject: How can i add conditions from model

I have a table: categories
- id
- type: News_Category, Rap_Category,
- parent_id
- name
- description
And 3 model: Category.php, NewsCategory.php, RapCategory.php

- File Category.php:
class Category extends ActiveRecord\Model {
public static $table_name = 'categories';
}
- File NewsCategory.php:
class NewsCategory extends Category {
...
}
- File RapCategory.php
class RapCategory extends Category {
....
}
I want to ask someone how can i add condition into 2 class NewsCategory and RapCategory with type field.
With NewsCategory, i want to select record have type = 'News_Category';
In the same to RapCategory model.
I don't want use: Category::all(array('conditions' => array('type = ?', 'News_Category'))) for record have type = News_Category. I only want to use: NewsCategory::all(array('conditions' => $anotherConditions));
You understand me?
Please help me. I did search but don't see anything relate.
Sr for my EL.