<?php
namespace App\Controller\BackController;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use App\Acme\Bundle\Utility\TemplatesUtility\MenusStandard;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\Stock;
/**
* @Route("/admin-product")
*/
class ProductBackController extends AbstractController
{
/**
* @Route("/new", name="app_product_back_new", methods={"GET"})
*/
public function new(Request $request,EntityManagerInterface $entitymanager): Response
{
$etat = array("reappro"=>0);
$listeStock = $entitymanager->getRepository(Stock::class)->findAll();
for($incr = 0 ; $incr < count($listeStock) ; $incr++){
if($listeStock[$incr]->getProduct()->getStockmin() > $listeStock[$incr]->getQuantite()) $etat["reappro"]++;
}
return $this->renderForm('backView/product/new.html.twig', [
"stocks"=>$listeStock,
"etat"=>$etat
]);
}
}