Would suggest some changes to your Controller:
In your controller you hard code your $id parameter to "5'. It's probably better to use routing annotation and have an optional parameter instead. Use the defaults to hardcode any default value.
Also, instead of $id, I suggest you call it $productID, so you know it is for a Product Entity, and to distinguish it from what you pass in the array (as a parameter) to your twig controller.
Also in your sample code you show passing in the parameter of id and name, but firstly $name is not defined anywhere, and $id is what you pass in as a parameter to the Controller, but then in your twig file you don't show using either of name or id at all! Plus you render productItem.html.twig, but above the post you call it product.html.twig. So is that a different file?
Make sure when you post question on Stackoverflow that everything is clear.
Here is sample of how you might change you controller code as per my suggestions above:
/**
* @Route("/showproduct/{productID}",
* defaults={"productID" = 0},
* name="showproduct
*/
public function showAction($productID)
{
$product = $this->getDoctrine()
->getRepository('AppBundle:Product')
->find($productID);
if (!$product) {
throw $this->createNotFoundException(
'No product found for id '.$productID
);
}
else
{
return $this->render('default/productItem.html.twig', array(
'product'=> $product,
));
}
}
Then in your twig file (is it productItem.html.twig???) then like this:
<ul id="navigation">
<li>
<a href="{{ product.getId }}">
{{ product.getDescription }}
</a>
</li>
</ul>
Hope it helps!
$productan object?href="{{ product.id }}"