I have updated my cakePHP application to 3.1 through composer, and I'm trying to fix all the small or deprecated warnings.
I could easily fix the $this->layout
stuff but I don't understand how to fix viewPath
errors.
Looking at the migration guide it looks like it should be exactly the same thing:
$this->viewPath = 'Element';
should become
$this->viewBuilder()->viewPath('Element');
But this is not working, and the only thing that I get is
Error: Call to undefined method Cake\View\ViewBuilder::viewPath()
File /var/www/myapp/src/Controller/InvoicesController.php
Line: 375
What is the correct way to fix this?