src/Controller/BackController/ProductBackController.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Controller\BackController;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use App\Acme\Bundle\Utility\TemplatesUtility\MenusStandard;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. use Doctrine\ORM\EntityManagerInterface;
  9. use App\Entity\Stock;
  10. /**
  11.  * @Route("/admin-product")
  12.  */
  13. class ProductBackController extends AbstractController
  14. {
  15.     /**
  16.      * @Route("/new", name="app_product_back_new", methods={"GET"})
  17.      */
  18.     public function new(Request $request,EntityManagerInterface $entitymanager): Response
  19.     {
  20.         
  21.         $etat = array("reappro"=>0);
  22.         $listeStock $entitymanager->getRepository(Stock::class)->findAll();
  23.         for($incr $incr count($listeStock) ; $incr++){
  24.             if($listeStock[$incr]->getProduct()->getStockmin() > $listeStock[$incr]->getQuantite())  $etat["reappro"]++;
  25.         }
  26.         
  27.         return $this->renderForm('backView/product/new.html.twig', [
  28.             "stocks"=>$listeStock,
  29.             "etat"=>$etat
  30.         ]);
  31.     }
  32. }