Welcome Guest, Not a member yet? Register   Sign In
Object oriented CI
#5

[eluser]Christer_[/eluser]
What i meen is that i want to do a instance class..

instead of doing

Code:
$this->user_model->get_name_by_current_user_id($this->session->userdata('userid'))
Or
Code:
$this->user_model->get_email_by_current_user_id($this->session->userdata('userid'))

i could just make a more personal side to another model witch says.
Code:
$this->user->email
$this->user->id

but i believe the right way to do this is to make a model "User.php"
and just autoload it with

Code:
class User extends CI_Model {

function __construct()
{
if ($this->session->userdata('userid'))
{
$id = $this->db->query

e.e
}
}
}

or am i completly missing som points in the mvc pattern here?


The reason why i am askin is because someone says i need to extend the CI_Controller with a MY_Controller and go from there.
Someone else means its a library since it contains user information
Someone, aswell as myself meens it should be model as there is DB interaction and it is to be used within the controller directly.


Messages In This Thread
Object oriented CI - by El Forum - 05-11-2012, 12:48 AM
Object oriented CI - by El Forum - 05-11-2012, 01:00 AM
Object oriented CI - by El Forum - 05-11-2012, 01:03 AM
Object oriented CI - by El Forum - 05-11-2012, 01:07 AM
Object oriented CI - by El Forum - 05-11-2012, 01:08 AM
Object oriented CI - by El Forum - 05-11-2012, 01:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB