[eluser]Unknown[/eluser]
Hi guys,
This is a newbie question... I got the following model function returning all the blog posts in the database matching the criterias :
Code:
function get_posts($id_website,$limit){
$this->db->select('*');
$this->db->from('blog_post');
$this->db->where('id_website',$id_website);
$this->db->orderby('post_date','desc');
$this->db->limit($limit);
$query = $this->db->get();
return $query;
}
Since I'm going to use that function over many controllers, I'd like to do some data manipulation and cleansing before returning the data to the controller. For example, i'd like to tranform fields that returns 0 or 1 to yes or no, do calculation on implied values, or be able to create a new property to the returned object... What would be the best practice in order to achieve this ?