Welcome Guest, Not a member yet? Register   Sign In
auto generating models from DB solution
#8

(12-20-2016, 11:35 AM)PaulD Wrote:
(12-20-2016, 12:16 AM)buoncri Wrote: On other hand you can use a my_model like these:

https://github.com/jamierumbelow/codeigniter-base-model or https://github.com/avenirer/CodeIgniter-MY_Model

for a rapid know how read http://www.codebyjeff.com/blog/2012/01/u...s-my_model

Now you say that I recall that for a while I did my own generalised model to which I could post instructions like

PHP Code:
$this->base_model->get_single_row('table_name'$id 127); 

But that was a while ago and I must admit in the end it became more cumbersome than useful. After all the CI query builder can be extremely compact all by itself at times without the need for the general base model.

PHP Code:
$this->db->from('table_name')->where('id'127)->get()->row_array(); 

So for the sake of maintainability I do not do it any more.

It's ok for simple requests but if we need to request through many-to-many relationships we must write query in controller so it's not very clean ?...(java behaviour  Blush )
Reply


Messages In This Thread
RE: auto generating models from DB solution - by brian85 - 12-20-2016, 01:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB