diff --git a/src/Controller/ProjectController.php b/src/Controller/ProjectController.php index c3e8d9c..3a67865 100644 --- a/src/Controller/ProjectController.php +++ b/src/Controller/ProjectController.php @@ -3,6 +3,8 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use App\Repository\ProjectRepository; +use App\Entity\ProjectEntity; class ProjectController extends AbstractExtendedController { @@ -15,6 +17,16 @@ */ public function projects(Request $request): Response { - return $this->render("project/projects.html.twig"); + // Get repositories + $entityManager = $this->getDoctrine()->getManager(); + /** @var ProjectRepository $projectRepository */ + $projectRepository = $entityManager->getRepository(ProjectEntity::class); + + // Get projects + $projects = $projectRepository->findAll(); + + return $this->render("project/projects.html.twig", [ + 'projects' => $projects, + ]); } } \ No newline at end of file diff --git a/templates/_includes/html/arrays/activityTasks.html.twig b/templates/_includes/html/arrays/activityTasks.html.twig deleted file mode 100644 index e69de29..0000000 --- a/templates/_includes/html/arrays/activityTasks.html.twig +++ /dev/null diff --git a/templates/_includes/html/arrays/project.html.twig b/templates/_includes/html/arrays/project.html.twig new file mode 100644 index 0000000..d163770 --- /dev/null +++ b/templates/_includes/html/arrays/project.html.twig @@ -0,0 +1,18 @@ + + + + + + + + + {% for project in projects %} + + + + + {% endfor %} + +
NomActif
{{ project.name }}{% if project.active %}Actif + {% endif %}
\ No newline at end of file diff --git a/templates/project/projects.html.twig b/templates/project/projects.html.twig index 212dedf..9602e2d 100644 --- a/templates/project/projects.html.twig +++ b/templates/project/projects.html.twig @@ -10,6 +10,7 @@

Projets

+ {% include "_includes/html/arrays/project.html.twig" with {projects: projects} only %}