Codeigniter Best Practices for Model functions
        Posted  
        
            by user270797
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user270797
        
        
        
        Published on 2010-05-27T05:30:07Z
        Indexed on 
            2010/05/27
            5:31 UTC
        
        
        Read the original article
        Hit count: 467
        
Say my application has a "Posts" model, and one of the function is add_post(), it might be something like:
function add_post($data) {
$this->db->insert('posts',$data);
}
Where $data is an array:
$data = array ('datetime'=>'2010-10-10 01:11:11', 'title'=>'test','body'=>'testing');
Is this best practice? It means if you use that function you need to know the names of the database fields where as my understanding of OOP is that you shouldnt need to know how the method works etc etc
© Stack Overflow or respective owner