Hi @djo, welcome!
The simple answer is that you’re trying to call the
render() method on
$this->view, but if you notice you haven’t defined it in your constructor. You have two choices:
- Add a
private $view; property at the top of your class and in your constructor add
$this->view = $container->get('view'); (working from memory, but I think that’s right)
- Or, in your
homePage() method, change
There’s a bigger piece where we don’t recommend that you inject the entire container, preferring to inject the dependencies themselves, but you appear to be using larger controllers, rather than dedicated action classes, so that will be a bit laborious. Also, if you’re using a container that supports auto-wiring (it looks like you’re using PHPDI, which does), you won’t get the best from it this way.
This is for another topic, though
I hope that helps.