Skip to content
Snippets Groups Projects
Commit 4310bae7 authored by Demian Katz's avatar Demian Katz
Browse files

Added constructor placeholder; fixed problem with immutable ViewModels.

parent 996dbc20
No related merge requests found
...@@ -46,6 +46,15 @@ class AbstractBase extends AbstractActionController ...@@ -46,6 +46,15 @@ class AbstractBase extends AbstractActionController
{ {
protected $serviceLocator; protected $serviceLocator;
/**
* Constructor
*/
public function __construct()
{
// Placeholder so child classes can call parent::__construct() in case
// of future global behavior.
}
/** /**
* Create a new ViewModel. * Create a new ViewModel.
* *
...@@ -55,7 +64,15 @@ class AbstractBase extends AbstractActionController ...@@ -55,7 +64,15 @@ class AbstractBase extends AbstractActionController
*/ */
protected function createViewModel($params = null) protected function createViewModel($params = null)
{ {
$view = new ViewModel($params); // I would expect to be able to just pass $params to the ViewModel
// constructor, but as of beta5, that seems to make the resulting
// object unable to accept additional variables.
$view = new ViewModel();
if (!empty($params)) {
foreach ($params as $k => $v) {
$view->setVariable($k, $v);
}
}
// Always make flash messenger available to view: // Always make flash messenger available to view:
$view->flashMessenger = $this->flashMessenger(); $view->flashMessenger = $this->flashMessenger();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment