use Interop\Container\ContainerInterface;
use Slim\Views\Twig;
namespace App\Http\Controller;
class Teste
{
public function main($request, $response, $args)
{
return $this->view->render($response, 'index.twig');
}
}
The message: Message: Call to a member function render() on null
namespace App\Http\Controller;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
class Teste
{
private $c = null;
public function __construct($container)
{
$this->c = $container;
}
public function main(Request $request, Response $response, $args)
{
$this->c['logger']->info(__METHOD__ . ' action dispatched');
$this->c['view']->render($response, 'Index.html.twig');
}