I am trying to combine this function...
public function index()
{
return $this->render('pages/index.html.twig', ['controller_name' => 'PagesController',]);
}
...with this function:
public function index()
{
$pages = $this->getDoctrine()->getRepository(Pages::class)->findAll();
return $this->render('pages/index.html.twig', array('pages' => $pages));
}
This is my approach:
public function index()
{
$pages = $this->getDoctrine()->getRepository(Pages::class)->findAll();
return $this->render('pages/index.html.twig', array('pages' => $pages),['controller_name' => 'PagesController',]);
}
But I get just an error message:
Argument 3 passed to Symfony\Bundle\FrameworkBundle\Controller\Controller::render() must be an instance of Symfony\Component\HttpFoundation\Response or null, array given, called in /Users/work/project/src/Controller/PagesController.php on line 18