Welcome Guest, Not a member yet? Register   Sign In
Is accessing post values directly in a model a good idea?
#1

[eluser]zrowcrypt[/eluser]
Both ways work but I am more interested to know which one is good practice :

1. Somecontroller.php

$name = $this->input->post['name'];
$this->load->model('somemodel');
$this->somemodel->modelfunction($name);

Vs

2 Somemodel_model.php

function modelfunction()
{
$name = $this->input->post['name'];
...
}

Should models be directly accessing values from the view(post data)? Isnt it better that controller passes the data and controls what model gets from the views?

I am very new to MVC so still picking up concepts so pardon me if my question are a little silly.

Thanks,
Vikas


Messages In This Thread
Is accessing post values directly in a model a good idea? - by El Forum - 10-10-2010, 05:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB