joomla/jissues — pull request #216 by elkuku (2013-11-15 20:37:43+00:00)
Title: Refactor site

This is about refactoring the controller and using the core DIC instead of our own bread.

I think the current [execute method](https://github.com/joomla/jissues/blob/master/src/JTracker/Controller/AbstractTrackerController.php#L137-205) is far too complex as it not only instantiates the view and the model as also echoing the result of the views render method.
Child classes have pretty less to override.
So I moved the instantiation of the model and view to an [initialize](https://github.com/joomla/jissues/blob/refactor-site/src/JTracker/Controller/AbstractTrackerController.php#L145-215) method that sets up the model and view based on the `$defaultView` property or the controller `name`.

So child classes can override this method and inject stuff to model and view classes. Note that the parent class must be called first.

```php
class Foo extends AbstractTrackerController
{
public function initialize()
{
parent::initialize();

$this->model->setFoo('bar');

// ...

return $this;
}
}
```

I also finished the renaming of the controller classes, which I started in 4e554f58c363c3a8fba4b214c95513f6803cc3c0, and apparently nothings blew ;)