I am wondering how the view communicates with the model.
As I understand the controller directs the correct information to the model.
class Controller
{
public function action()
{
if(isset($_POST) )
{
$this->model->someMethod($_POST['foo'],$_POST['bar']);
}
}
}
The model does it's business.
class Model
{
public function someMethod($foo,$bar)
{
// do something
}
}
The view has to somehow know how to communicate with the model to get it's current state. But how it this done?
class View
{
public function action()
{
// ask the model what is going on
}
}
How does the view know what happened and if everything went the correct way. I though of getting some state of the model with a 'getState()' method on the model. The state is some string the view knows what to do with But it doesn't seem the right way to me. How does the view know if somebody is logged in for example? Should the view actually know about this?