src/Controller/UserProjects/MyUserProjectsController.php line 23
<?phpnamespace App\Controller\UserProjects;use App\Entity\UserProjets;use App\Entity\Commentaires;use App\Form\CommentairesType;use App\Form\UserProjetsType;use App\Repository\ProjetsRepository;use Doctrine\ORM\EntityManagerInterface;use App\Repository\UserProjetsRepository;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\Routing\Annotation\Route;use Symfony\Component\Security\Core\User\UserInterface;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;class MyUserProjectsController extends AbstractController{#[Route('/mesprojets', name: 'app_my_user_projects', methods: ['GET'])]public function index(UserProjetsRepository $userProjetsRepository): Response{$user = $this->getUser();$projects = $userProjetsRepository->findBy(['user' => $user]);//IF NOT LOGINif (!$user) {return $this->redirectToRoute('app_login');}return $this->render('user_projets/my_project.html.twig', ['user_projects' => $projects,]);}}