$this->denyAccessUnlessGranted(PostVoter::EDIT, $post);
/**
*
*@Route('/product/{id}/edit')
*/
public function edit(Product $product, Request $request)
{
}
$em = $this->getDoctrine()->getManager();
$product = $em->getRepository('AppBundle:Product')->find($productId);
$form = $this->createForm(ProductType::class, $product);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em->flush();
return $this->redirectToRoute('home');
}
return $this->render('@App/Product/edit.html.twig', [
'form' => $form->createView()
]);