/**
  * @Route("/produkt/{permalink}", name="product_url")
  */
 public function indexAction($permalink)
 {
     $product = $this->getDoctrine()->getRepository('ShopBundle:Products')->findOneBy(['permalink' => $permalink]);
     //   ->getOneWithCategoryAndPropertiesByPermalink($permalink);
     $breadcrumbs = $this->get("white_october_breadcrumbs");
     // Simple example
     $breadcrumbs->addItem("Home", $this->get("router")->generate("homepage_url"));
     $breadcrumbs->addItem("Produkty", $this->get("router")->generate("listing_url"));
     $breadcrumbs->addItem($product->getName(), $this->get("router")->generate("product_url", ['permalink' => $permalink]));
     $productForm = new Products();
     $productForm->setId($product->getId());
     $productForm = $this->createFormBuilder($productForm)->setAction($this->generateUrl('add_to_checkout'))->add('id', HiddenType::class)->add('variantsInput', HiddenType::class)->getForm();
     return $this->render('ShopBundle:Product:product.html.twig', ['product' => $product, 'productFormToCheckout' => $productForm->createView()]);
 }
 public function makeProductForm($product = null)
 {
     $productForm = new Products();
     $productIdToAction = '';
     $productPermalinkToAction = '';
     if ($product) {
         $productIdToAction = '/' . $product->getId();
         $productPermalinkToAction = $product->getPermalink();
         $productForm->setId($product->getId())->setName($product->getName())->setPermalink($product->getPermalink())->setPrice($product->getPrice())->setDescription(str_replace('<br />', "\r\n", $product->getDescription()))->setIsActive($product->getIsActive())->setIsNew($product->getIsNew());
     } else {
         $productForm->setIsActive(false)->setIsNew(false);
     }
     $productForm = $this->createFormBuilder($productForm)->setAction($this->generateUrl('add_products_action_manager_url') . $productIdToAction)->add('id', HiddenType::class)->add('name', TextType::class, ['label' => 'Nazwa: ', 'required' => false])->add('permalink', TextType::class, ['label' => 'Link: ', 'attr' => ['data-permalink' => $productPermalinkToAction]])->add('price', TextType::class, ['label' => 'Cena: '])->add('description', TextareaType::class, ['label' => 'Opis: '])->add('categoriesInput', HiddenType::class)->add('variantsInput', HiddenType::class)->add('propertiesInput', HiddenType::class)->add('isNew', CheckboxType::class, ['label' => 'Jest nowością: '])->add('isActive', CheckboxType::class, ['label' => 'Jest aktywny: '])->add('imgCount', HiddenType::class)->add('photo', FileType::class, ['multiple' => true, 'label' => 'Dodaj zdjęcia: '])->getForm();
     return $productForm;
 }