At the moment, I've got a fat controller and a thinner model layer.
My controller looks something like this.
namespace controller;
class home
{
public $template = 'home';
protected $database;
public function __construct(\Zend\Db\Adapter\Adapter $database){
$this->database = $database;
}
/**
* Returns the home page
*/
public function indexView(){
$userService = new UserService($this->database);
$view = new ViewModel($this->template);
$view->assign('pageTitle', 'Home');
$view->assign('lead', "Welcome ".$userService->getFirstName());
$view->assign('h1', 'Home');
}
}
My model would consist of data manipulation, data gathering etc.
The viewModel class this calls, the view, is basically a container class which includes the header, footer and the actual template used inside.
In terms of MVC, I now understand that the Model and View are aware of each other.
Am I going about this the right way?