public function pages($slug, PagesGenerator $pagesGenerator)
{
$output = $pagesGenerator->getPages($slug);
// here is your error: $page is not defined.
$id = $page->getId();
// something like this?
$id = $output['page']->getId();
return $this->render('list.html.twig', [ 'output' => $output, 'id' => $id]);
}
solved How can I get access to service variables?