connexion base et création premier crud
This commit is contained in:
2
.env
2
.env
@@ -32,7 +32,7 @@ DEFAULT_URI=http://localhost
|
|||||||
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data_%kernel.environment%.db"
|
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data_%kernel.environment%.db"
|
||||||
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
|
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
|
||||||
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
|
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
|
||||||
DATABASE_URL="mysql://contrib_root:123abc@127.0.0.1:3306/contrib?serverVersion=8.0.32&charset=utf8mb4"
|
DATABASE_URL="mysql://contribA_root:123abc@127.0.0.1:3306/contribC?serverVersion=8.0.32&charset=utf8mb4"
|
||||||
###< doctrine/doctrine-bundle ###
|
###< doctrine/doctrine-bundle ###
|
||||||
###> symfony/messenger ###
|
###> symfony/messenger ###
|
||||||
# Choose one of the transports below
|
# Choose one of the transports below
|
||||||
|
|||||||
81
src/Controller/ContributionController.php
Normal file
81
src/Controller/ContributionController.php
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Entity\Contribution;
|
||||||
|
use App\Form\ContributionType;
|
||||||
|
use App\Repository\ContributionRepository;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|
||||||
|
#[Route('/contribution')]
|
||||||
|
final class ContributionController extends AbstractController
|
||||||
|
{
|
||||||
|
#[Route(name: 'app_contribution_index', methods: ['GET'])]
|
||||||
|
public function index(ContributionRepository $contributionRepository): Response
|
||||||
|
{
|
||||||
|
return $this->render('contribution/index.html.twig', [
|
||||||
|
'contributions' => $contributionRepository->findAll(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/new', name: 'app_contribution_new', methods: ['GET', 'POST'])]
|
||||||
|
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||||
|
{
|
||||||
|
$contribution = new Contribution();
|
||||||
|
$form = $this->createForm(ContributionType::class, $contribution);
|
||||||
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
$entityManager->persist($contribution);
|
||||||
|
$entityManager->flush();
|
||||||
|
|
||||||
|
return $this->redirectToRoute('app_contribution_index', [], Response::HTTP_SEE_OTHER);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('contribution/new.html.twig', [
|
||||||
|
'contribution' => $contribution,
|
||||||
|
'form' => $form,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/{id}', name: 'app_contribution_show', methods: ['GET'])]
|
||||||
|
public function show(Contribution $contribution): Response
|
||||||
|
{
|
||||||
|
return $this->render('contribution/show.html.twig', [
|
||||||
|
'contribution' => $contribution,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/{id}/edit', name: 'app_contribution_edit', methods: ['GET', 'POST'])]
|
||||||
|
public function edit(Request $request, Contribution $contribution, EntityManagerInterface $entityManager): Response
|
||||||
|
{
|
||||||
|
$form = $this->createForm(ContributionType::class, $contribution);
|
||||||
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
$entityManager->flush();
|
||||||
|
|
||||||
|
return $this->redirectToRoute('app_contribution_index', [], Response::HTTP_SEE_OTHER);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('contribution/edit.html.twig', [
|
||||||
|
'contribution' => $contribution,
|
||||||
|
'form' => $form,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/{id}', name: 'app_contribution_delete', methods: ['POST'])]
|
||||||
|
public function delete(Request $request, Contribution $contribution, EntityManagerInterface $entityManager): Response
|
||||||
|
{
|
||||||
|
if ($this->isCsrfTokenValid('delete'.$contribution->getId(), $request->getPayload()->getString('_token'))) {
|
||||||
|
$entityManager->remove($contribution);
|
||||||
|
$entityManager->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirectToRoute('app_contribution_index', [], Response::HTTP_SEE_OTHER);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,8 @@
|
|||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
use App\Entity\Membre;
|
use App\Entity\Membre;
|
||||||
use App\Form\MembreType;
|
use App\Form\Membre2Type;
|
||||||
|
use App\Repository\MembreRepository;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
@@ -14,14 +15,10 @@ use Symfony\Component\Routing\Attribute\Route;
|
|||||||
final class MembreController extends AbstractController
|
final class MembreController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route(name: 'app_membre_index', methods: ['GET'])]
|
#[Route(name: 'app_membre_index', methods: ['GET'])]
|
||||||
public function index(EntityManagerInterface $entityManager): Response
|
public function index(MembreRepository $membreRepository): Response
|
||||||
{
|
{
|
||||||
$membres = $entityManager
|
|
||||||
->getRepository(Membre::class)
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
return $this->render('membre/index.html.twig', [
|
return $this->render('membre/index.html.twig', [
|
||||||
'membres' => $membres,
|
'membres' => $membreRepository->findAll(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +26,7 @@ final class MembreController extends AbstractController
|
|||||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||||
{
|
{
|
||||||
$membre = new Membre();
|
$membre = new Membre();
|
||||||
$form = $this->createForm(MembreType::class, $membre);
|
$form = $this->createForm(Membre2Type::class, $membre);
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
@@ -56,7 +53,7 @@ final class MembreController extends AbstractController
|
|||||||
#[Route('/{id}/edit', name: 'app_membre_edit', methods: ['GET', 'POST'])]
|
#[Route('/{id}/edit', name: 'app_membre_edit', methods: ['GET', 'POST'])]
|
||||||
public function edit(Request $request, Membre $membre, EntityManagerInterface $entityManager): Response
|
public function edit(Request $request, Membre $membre, EntityManagerInterface $entityManager): Response
|
||||||
{
|
{
|
||||||
$form = $this->createForm(MembreType::class, $membre);
|
$form = $this->createForm(Membre2Type::class, $membre);
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
|||||||
84
src/Controller/ProjetController.php
Normal file
84
src/Controller/ProjetController.php
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Entity\Projet;
|
||||||
|
use App\Form\ProjetType;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|
||||||
|
#[Route('/projet')]
|
||||||
|
final class ProjetController extends AbstractController
|
||||||
|
{
|
||||||
|
#[Route(name: 'app_projet_index', methods: ['GET'])]
|
||||||
|
public function index(EntityManagerInterface $entityManager): Response
|
||||||
|
{
|
||||||
|
$projets = $entityManager
|
||||||
|
->getRepository(Projet::class)
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
return $this->render('projet/index.html.twig', [
|
||||||
|
'projets' => $projets,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/new', name: 'app_projet_new', methods: ['GET', 'POST'])]
|
||||||
|
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||||
|
{
|
||||||
|
$projet = new Projet();
|
||||||
|
$form = $this->createForm(ProjetType::class, $projet);
|
||||||
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
$entityManager->persist($projet);
|
||||||
|
$entityManager->flush();
|
||||||
|
|
||||||
|
return $this->redirectToRoute('app_projet_index', [], Response::HTTP_SEE_OTHER);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('projet/new.html.twig', [
|
||||||
|
'projet' => $projet,
|
||||||
|
'form' => $form,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/{id}', name: 'app_projet_show', methods: ['GET'])]
|
||||||
|
public function show(Projet $projet): Response
|
||||||
|
{
|
||||||
|
return $this->render('projet/show.html.twig', [
|
||||||
|
'projet' => $projet,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/{id}/edit', name: 'app_projet_edit', methods: ['GET', 'POST'])]
|
||||||
|
public function edit(Request $request, Projet $projet, EntityManagerInterface $entityManager): Response
|
||||||
|
{
|
||||||
|
$form = $this->createForm(ProjetType::class, $projet);
|
||||||
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
$entityManager->flush();
|
||||||
|
|
||||||
|
return $this->redirectToRoute('app_projet_index', [], Response::HTTP_SEE_OTHER);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('projet/edit.html.twig', [
|
||||||
|
'projet' => $projet,
|
||||||
|
'form' => $form,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/{id}', name: 'app_projet_delete', methods: ['POST'])]
|
||||||
|
public function delete(Request $request, Projet $projet, EntityManagerInterface $entityManager): Response
|
||||||
|
{
|
||||||
|
if ($this->isCsrfTokenValid('delete'.$projet->getId(), $request->getPayload()->getString('_token'))) {
|
||||||
|
$entityManager->remove($projet);
|
||||||
|
$entityManager->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirectToRoute('app_projet_index', [], Response::HTTP_SEE_OTHER);
|
||||||
|
}
|
||||||
|
}
|
||||||
65
src/Entity/Contribution.php
Normal file
65
src/Entity/Contribution.php
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\ContributionRepository;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: ContributionRepository::class)]
|
||||||
|
class Contribution
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column(type: 'integer')]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(targetEntity: Membre::class, inversedBy: 'contributions')]
|
||||||
|
#[ORM\JoinColumn(name: 'membre_id', referencedColumnName: 'id', nullable: false)]
|
||||||
|
private ?Membre $membre = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(targetEntity: Projet::class)]
|
||||||
|
#[ORM\JoinColumn(name: 'projet_id', referencedColumnName: 'id', nullable: false)]
|
||||||
|
private ?Projet $projet = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: 'integer', options: ['default' => 0])]
|
||||||
|
private ?int $duree = 0;
|
||||||
|
|
||||||
|
// Getters et Setters...
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMembre(): ?Membre
|
||||||
|
{
|
||||||
|
return $this->membre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMembre(?Membre $membre): static
|
||||||
|
{
|
||||||
|
$this->membre = $membre;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProjet(): ?Projet
|
||||||
|
{
|
||||||
|
return $this->projet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setProjet(?Projet $projet): static
|
||||||
|
{
|
||||||
|
$this->projet = $projet;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDuree(): ?int
|
||||||
|
{
|
||||||
|
return $this->duree;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDuree(int $duree): static
|
||||||
|
{
|
||||||
|
$this->duree = $duree;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
// src/Entity/Droit.php
|
|
||||||
namespace App\Entity;
|
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
#[ORM\Entity]
|
|
||||||
#[ORM\Table(name: "Droit")]
|
|
||||||
class Droit
|
|
||||||
{
|
|
||||||
#[ORM\Id]
|
|
||||||
#[ORM\GeneratedValue]
|
|
||||||
#[ORM\Column(type: "integer", name: "idDroit")]
|
|
||||||
private ?int $idDroit = null;
|
|
||||||
|
|
||||||
#[ORM\Column(type: "string", length: 30, name: "LibDroit")]
|
|
||||||
private ?string $libDroit = null;
|
|
||||||
|
|
||||||
// Getter et Setter
|
|
||||||
public function getIdDroit(): ?int
|
|
||||||
{
|
|
||||||
return $this->idDroit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLibDroit(): ?string
|
|
||||||
{
|
|
||||||
return $this->libDroit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setLibDroit(string $libDroit): self
|
|
||||||
{
|
|
||||||
$this->libDroit = $libDroit;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,37 +1,71 @@
|
|||||||
<?php
|
<?php
|
||||||
// src/Entity/Membre.php
|
|
||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\MembreRepository;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
#[ORM\Entity]
|
#[ORM\Entity]
|
||||||
#[ORM\Table(name: "Membre")]
|
#[ORM\Table(name: "membre")]
|
||||||
class Membre
|
class Membre
|
||||||
{
|
{
|
||||||
#[ORM\Id]
|
#[ORM\Id]
|
||||||
#[ORM\Column(type: "string", length: 20)]
|
#[ORM\Column(type: 'string', length: 20)]
|
||||||
private ?string $id = null;
|
private ?string $id = null;
|
||||||
|
|
||||||
#[ORM\Column(type: "string", length: 50)]
|
#[ORM\Column(type: 'string', length: 50)]
|
||||||
private ?string $nom = null;
|
private ?string $nom = null;
|
||||||
|
|
||||||
#[ORM\Column(type: "string", length: 100, nullable: true)]
|
#[ORM\Column(type: 'string', length: 100)]
|
||||||
private ?string $password = null;
|
private ?string $password = null;
|
||||||
|
|
||||||
#[ORM\ManyToOne(targetEntity: Droit::class)]
|
#[ORM\Column(type: 'string', length: 50, options: ['default' => 'dev'])]
|
||||||
#[ORM\JoinColumn(name: "droit_id", referencedColumnName: "idDroit", nullable: true, onDelete: "SET NULL")]
|
private ?string $droit = 'dev';
|
||||||
private ?Droit $droit = null;
|
|
||||||
|
|
||||||
// Getters et setters
|
#[ORM\OneToMany(mappedBy: 'membre', targetEntity: Contribution::class)]
|
||||||
public function getId(): ?string { return $this->id; }
|
private Collection $contributions;
|
||||||
public function setId(string $id): self { $this->id = $id; return $this; }
|
|
||||||
|
|
||||||
public function getNom(): ?string { return $this->nom; }
|
public function __construct()
|
||||||
public function setNom(string $nom): self { $this->nom = $nom; return $this; }
|
{
|
||||||
|
$this->contributions = new ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
public function getPassword(): ?string { return $this->password; }
|
// Getters et Setters...
|
||||||
public function setPassword(?string $password): self { $this->password = $password; return $this; }
|
public function getId(): ?string
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
public function getDroit(): ?Droit { return $this->droit; }
|
public function getNom(): ?string
|
||||||
public function setDroit(?Droit $droit): self { $this->droit = $droit; return $this; }
|
{
|
||||||
|
return $this->nom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNom(string $nom): static
|
||||||
|
{
|
||||||
|
$this->nom = $nom;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPassword(): ?string
|
||||||
|
{
|
||||||
|
return $this->password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPassword(string $password): static
|
||||||
|
{
|
||||||
|
$this->password = $password;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDroit(): ?string
|
||||||
|
{
|
||||||
|
return $this->droit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDroit(string $droit): static
|
||||||
|
{
|
||||||
|
$this->droit = $droit;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
35
src/Entity/Projet.php
Normal file
35
src/Entity/Projet.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\ProjetRepository;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity]
|
||||||
|
#[ORM\Table(name: "projet")]
|
||||||
|
class Projet
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\Column(type: 'string', length: 20)]
|
||||||
|
private ?string $id = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: 'string', length: 50)]
|
||||||
|
private ?string $nom = null;
|
||||||
|
|
||||||
|
// Getters et Setters...
|
||||||
|
public function getId(): ?string
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNom(): ?string
|
||||||
|
{
|
||||||
|
return $this->nom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNom(string $nom): static
|
||||||
|
{
|
||||||
|
$this->nom = $nom;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,23 +2,26 @@
|
|||||||
|
|
||||||
namespace App\Form;
|
namespace App\Form;
|
||||||
|
|
||||||
use App\Entity\Droit;
|
use App\Entity\Contribution;
|
||||||
use App\Entity\Membre;
|
use App\Entity\Membre;
|
||||||
|
use App\Entity\Projet;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
class Membre1Type extends AbstractType
|
class ContributionType extends AbstractType
|
||||||
{
|
{
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('id')
|
->add('duree')
|
||||||
->add('nom')
|
->add('membre', EntityType::class, [
|
||||||
->add('password')
|
'class' => Membre::class,
|
||||||
->add('droit', EntityType::class, [
|
'choice_label' => 'id',
|
||||||
'class' => Droit::class,
|
])
|
||||||
|
->add('projet', EntityType::class, [
|
||||||
|
'class' => Projet::class,
|
||||||
'choice_label' => 'id',
|
'choice_label' => 'id',
|
||||||
])
|
])
|
||||||
;
|
;
|
||||||
@@ -27,7 +30,7 @@ class Membre1Type extends AbstractType
|
|||||||
public function configureOptions(OptionsResolver $resolver): void
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
{
|
{
|
||||||
$resolver->setDefaults([
|
$resolver->setDefaults([
|
||||||
'data_class' => Membre::class,
|
'data_class' => Contribution::class,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
45
src/Form/Membre2Type.php
Normal file
45
src/Form/Membre2Type.php
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form;
|
||||||
|
|
||||||
|
use App\Entity\Membre;
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
class Membre2Type extends AbstractType
|
||||||
|
{
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
|
{
|
||||||
|
$builder
|
||||||
|
->add('id')
|
||||||
|
->add('nom')
|
||||||
|
->add('plainPassword', PasswordType::class, [
|
||||||
|
'label' => 'Mot de passe',
|
||||||
|
'mapped' => false,
|
||||||
|
'required' => false,
|
||||||
|
'attr' => [
|
||||||
|
'placeholder' => 'Saisir le mot de passe',
|
||||||
|
],
|
||||||
|
])
|
||||||
|
->add('droit', ChoiceType::class, [
|
||||||
|
'label' => 'Droit',
|
||||||
|
'choices' => [
|
||||||
|
'dev' => 'dev',
|
||||||
|
'admin' => 'admin',
|
||||||
|
],
|
||||||
|
'placeholder' => 'Sélectionnez un droit',
|
||||||
|
'required' => true,
|
||||||
|
])
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
{
|
||||||
|
$resolver->setDefaults([
|
||||||
|
'data_class' => Membre::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Form;
|
|
||||||
|
|
||||||
use App\Entity\Droit;
|
|
||||||
use App\Entity\Membre;
|
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
||||||
|
|
||||||
class MembreType extends AbstractType
|
|
||||||
{
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
|
||||||
{
|
|
||||||
$builder
|
|
||||||
->add('id')
|
|
||||||
->add('nom')
|
|
||||||
->add('password')
|
|
||||||
->add('droit', EntityType::class, [
|
|
||||||
'class' => Droit::class,
|
|
||||||
'choice_label' => 'id',
|
|
||||||
])
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver): void
|
|
||||||
{
|
|
||||||
$resolver->setDefaults([
|
|
||||||
'data_class' => Membre::class,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,24 +2,25 @@
|
|||||||
|
|
||||||
namespace App\Form;
|
namespace App\Form;
|
||||||
|
|
||||||
use App\Entity\Droit;
|
use App\Entity\Projet;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
class DroitType extends AbstractType
|
class ProjetType extends AbstractType
|
||||||
{
|
{
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('libDroit')
|
->add('id')
|
||||||
|
->add('nom')
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver): void
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
{
|
{
|
||||||
$resolver->setDefaults([
|
$resolver->setDefaults([
|
||||||
'data_class' => Droit::class,
|
'data_class' => Projet::class,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
13
templates/_bootstrap.html.twig
Normal file
13
templates/_bootstrap.html.twig
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{#
|
||||||
|
Shared partial to include Bootstrap. Use with:
|
||||||
|
{{ include('_bootstrap.html.twig', { part: 'css' }) }} in the <head>
|
||||||
|
{{ include('_bootstrap.html.twig', { part: 'js' }) }} before closing </body>
|
||||||
|
#}
|
||||||
|
|
||||||
|
{% if part == 'css' %}
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||||
|
{% elseif part == 'js' %}
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
@@ -5,13 +5,17 @@
|
|||||||
<title>{% block title %}Welcome!{% endblock %}</title>
|
<title>{% block title %}Welcome!{% endblock %}</title>
|
||||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">
|
||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
|
{{ include('_bootstrap.html.twig', { part: 'css' }) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block javascripts %}
|
{% block javascripts %}
|
||||||
|
{{ include('_bootstrap.html.twig', { part: 'js' }) }}
|
||||||
{% block importmap %}{{ importmap('app') }}{% endblock %}
|
{% block importmap %}{{ importmap('app') }}{% endblock %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{% block body %}{% endblock %}
|
<div class="container py-4">
|
||||||
|
{% block body %}{% endblock %}
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
4
templates/contribution/_delete_form.html.twig
Normal file
4
templates/contribution/_delete_form.html.twig
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<form method="post" action="{{ path('app_contribution_delete', {'id': contribution.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||||
|
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ contribution.id) }}">
|
||||||
|
<button class="btn">Delete</button>
|
||||||
|
</form>
|
||||||
13
templates/contribution/edit.html.twig
Normal file
13
templates/contribution/edit.html.twig
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}Edit Contribution{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>Edit Contribution</h1>
|
||||||
|
|
||||||
|
{{ include('contribution/_form.html.twig', {'button_label': 'Update'}) }}
|
||||||
|
|
||||||
|
<a href="{{ path('app_contribution_index') }}">back to list</a>
|
||||||
|
|
||||||
|
{{ include('contribution/_delete_form.html.twig') }}
|
||||||
|
{% endblock %}
|
||||||
35
templates/contribution/index.html.twig
Normal file
35
templates/contribution/index.html.twig
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}Contribution index{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>Contribution index</h1>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Id</th>
|
||||||
|
<th>Duree</th>
|
||||||
|
<th>actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for contribution in contributions %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ contribution.id }}</td>
|
||||||
|
<td>{{ contribution.duree }}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ path('app_contribution_show', {'id': contribution.id}) }}">show</a>
|
||||||
|
<a href="{{ path('app_contribution_edit', {'id': contribution.id}) }}">edit</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% else %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3">no records found</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<a href="{{ path('app_contribution_new') }}">Create new</a>
|
||||||
|
{% endblock %}
|
||||||
11
templates/contribution/new.html.twig
Normal file
11
templates/contribution/new.html.twig
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}New Contribution{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>Create new Contribution</h1>
|
||||||
|
|
||||||
|
{{ include('contribution/_form.html.twig') }}
|
||||||
|
|
||||||
|
<a href="{{ path('app_contribution_index') }}">back to list</a>
|
||||||
|
{% endblock %}
|
||||||
26
templates/contribution/show.html.twig
Normal file
26
templates/contribution/show.html.twig
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}Contribution{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>Contribution</h1>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>Id</th>
|
||||||
|
<td>{{ contribution.id }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Duree</th>
|
||||||
|
<td>{{ contribution.duree }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<a href="{{ path('app_contribution_index') }}">back to list</a>
|
||||||
|
|
||||||
|
<a href="{{ path('app_contribution_edit', {'id': contribution.id}) }}">edit</a>
|
||||||
|
|
||||||
|
{{ include('contribution/_delete_form.html.twig') }}
|
||||||
|
{% endblock %}
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
<form method="post" action="{{ path('app_droit_delete', {'idDroit': droit.idDroit}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ droit.idDroit) }}">
|
|
||||||
<button class="btn">Delete</button>
|
|
||||||
</form>
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
{% extends 'base.html.twig' %}
|
|
||||||
|
|
||||||
{% block title %}Edit Droit{% endblock %}
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
<h1>Edit Droit</h1>
|
|
||||||
|
|
||||||
{{ include('droit/_form.html.twig', {'button_label': 'Update'}) }}
|
|
||||||
|
|
||||||
<a href="{{ path('app_droit_index') }}">back to list</a>
|
|
||||||
|
|
||||||
{{ include('droit/_delete_form.html.twig') }}
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
{% extends 'base.html.twig' %}
|
|
||||||
|
|
||||||
{% block title %}Droit index{% endblock %}
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
<h1>Droit index</h1>
|
|
||||||
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>IdDroit</th>
|
|
||||||
<th>LibDroit</th>
|
|
||||||
<th>actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for droit in droits %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ droit.idDroit }}</td>
|
|
||||||
<td>{{ droit.libDroit }}</td>
|
|
||||||
<td>
|
|
||||||
<a href="{{ path('app_droit_show', {'idDroit': droit.idDroit}) }}">show</a>
|
|
||||||
<a href="{{ path('app_droit_edit', {'idDroit': droit.idDroit}) }}">edit</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% else %}
|
|
||||||
<tr>
|
|
||||||
<td colspan="3">no records found</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<a href="{{ path('app_droit_new') }}">Create new</a>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{% extends 'base.html.twig' %}
|
|
||||||
|
|
||||||
{% block title %}New Droit{% endblock %}
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
<h1>Create new Droit</h1>
|
|
||||||
|
|
||||||
{{ include('droit/_form.html.twig') }}
|
|
||||||
|
|
||||||
<a href="{{ path('app_droit_index') }}">back to list</a>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
{% extends 'base.html.twig' %}
|
|
||||||
|
|
||||||
{% block title %}Droit{% endblock %}
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
<h1>Droit</h1>
|
|
||||||
|
|
||||||
<table class="table">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th>IdDroit</th>
|
|
||||||
<td>{{ droit.idDroit }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>LibDroit</th>
|
|
||||||
<td>{{ droit.libDroit }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<a href="{{ path('app_droit_index') }}">back to list</a>
|
|
||||||
|
|
||||||
<a href="{{ path('app_droit_edit', {'idDroit': droit.idDroit}) }}">edit</a>
|
|
||||||
|
|
||||||
{{ include('droit/_delete_form.html.twig') }}
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<form method="post" action="{{ path('app_membre_delete', {'id': membre.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
<form method="post" action="{{ path('app_membre_delete', {'id': membre.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ membre.id) }}">
|
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ membre.id) }}">
|
||||||
<button class="btn">Delete</button>
|
<button class="btn btn-danger">Delete</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{{ form_start(form) }}
|
{{ form_start(form) }}
|
||||||
{{ form_widget(form) }}
|
{{ form_widget(form) }}
|
||||||
<button class="btn">{{ button_label|default('Save') }}</button>
|
<button class="btn btn-primary">{{ button_label|default('Save') }}</button>
|
||||||
{{ form_end(form) }}
|
{{ form_end(form) }}
|
||||||
|
|||||||
@@ -3,11 +3,16 @@
|
|||||||
{% block title %}Edit Membre{% endblock %}
|
{% block title %}Edit Membre{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1>Edit Membre</h1>
|
<div class="card mb-3">
|
||||||
|
<div class="card-header">
|
||||||
{{ include('membre/_form.html.twig', {'button_label': 'Update'}) }}
|
<h1 class="h4 mb-0">Edit Membre</h1>
|
||||||
|
</div>
|
||||||
<a href="{{ path('app_membre_index') }}">back to list</a>
|
<div class="card-body">
|
||||||
|
{{ include('membre/_form.html.twig', {'button_label': 'Update'}) }}
|
||||||
{{ include('membre/_delete_form.html.twig') }}
|
<div class="d-flex gap-2 mt-2">
|
||||||
|
<a href="{{ path('app_membre_index') }}" class="btn btn-outline-secondary">Back to list</a>
|
||||||
|
{{ include('membre/_delete_form.html.twig') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -2,44 +2,37 @@
|
|||||||
|
|
||||||
{% block title %}Membre index{% endblock %}
|
{% block title %}Membre index{% endblock %}
|
||||||
|
|
||||||
{% block stylesheets %}
|
|
||||||
{{ parent() }}
|
|
||||||
{# Ajouter Bootstrap depuis le CDN #}
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="container mt-4">
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||||
<h1 class="mb-4">Membre index</h1>
|
<h1 class="h3 mb-0">Membres</h1>
|
||||||
|
|
||||||
<table class="table table-striped table-bordered">
|
|
||||||
<thead class="table-dark">
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<th>Nom</th>
|
|
||||||
<th>Password</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for membre in membres %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ membre.id }}</td>
|
|
||||||
<td>{{ membre.nom }}</td>
|
|
||||||
<td>{{ membre.password }}</td>
|
|
||||||
<td>
|
|
||||||
<a href="{{ path('app_membre_show', {'id': membre.id}) }}" class="btn btn-sm btn-primary">Show</a>
|
|
||||||
<a href="{{ path('app_membre_edit', {'id': membre.id}) }}" class="btn btn-sm btn-warning">Edit</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% else %}
|
|
||||||
<tr>
|
|
||||||
<td colspan="4" class="text-center">No records found</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<a href="{{ path('app_membre_new') }}" class="btn btn-success">Create new</a>
|
<a href="{{ path('app_membre_new') }}" class="btn btn-success">Create new</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<table class="table table-striped table-hover align-middle">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Id</th>
|
||||||
|
<th>Nom</th>
|
||||||
|
<th>Droit</th>
|
||||||
|
<th class="text-end">Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for membre in membres %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ membre.id }}</td>
|
||||||
|
<td>{{ membre.nom }}</td>
|
||||||
|
<td>{{ membre.droit }}</td>
|
||||||
|
<td class="text-end">
|
||||||
|
<a href="{{ path('app_membre_show', {'id': membre.id}) }}" class="btn btn-sm btn-outline-primary me-1">Show</a>
|
||||||
|
<a href="{{ path('app_membre_edit', {'id': membre.id}) }}" class="btn btn-sm btn-outline-secondary">Edit</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% else %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="5" class="text-center text-muted">No records found</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
{# templates/membre/index.html.twig #}
|
|
||||||
|
|
||||||
<h1>Liste des Membres</h1>
|
|
||||||
|
|
||||||
<table border="1">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>ID</th>
|
|
||||||
<th>Nom</th>
|
|
||||||
<th>Droit</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for membre in membres %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ membre.id }}</td>
|
|
||||||
<td>{{ membre.nom }}</td>
|
|
||||||
<td>{{ membre.droit ? membre.droit.nom : 'Aucun' }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
@@ -3,9 +3,13 @@
|
|||||||
{% block title %}New Membre{% endblock %}
|
{% block title %}New Membre{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1>Create new Membre</h1>
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
{{ include('membre/_form.html.twig') }}
|
<h1 class="h4 mb-0">Create new Membre</h1>
|
||||||
|
</div>
|
||||||
<a href="{{ path('app_membre_index') }}">back to list</a>
|
<div class="card-body">
|
||||||
|
{{ include('membre/_form.html.twig') }}
|
||||||
|
<a href="{{ path('app_membre_index') }}" class="btn btn-outline-secondary mt-2">Back to list</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -3,9 +3,15 @@
|
|||||||
{% block title %}Membre{% endblock %}
|
{% block title %}Membre{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1>Membre</h1>
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||||
|
<h1 class="h3 mb-0">Membre #{{ membre.id }}</h1>
|
||||||
|
<div>
|
||||||
|
<a href="{{ path('app_membre_edit', {'id': membre.id}) }}" class="btn btn-secondary me-2">Edit</a>
|
||||||
|
<a href="{{ path('app_membre_index') }}" class="btn btn-outline-secondary">Back to list</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<table class="table">
|
<table class="table table-bordered">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Id</th>
|
<th>Id</th>
|
||||||
@@ -17,14 +23,16 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Password</th>
|
<th>Password</th>
|
||||||
<td>{{ membre.password }}</td>
|
<td>********</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Droit</th>
|
||||||
|
<td>{{ membre.droit }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<a href="{{ path('app_membre_index') }}">back to list</a>
|
<div class="mt-3">
|
||||||
|
{{ include('membre/_delete_form.html.twig') }}
|
||||||
<a href="{{ path('app_membre_edit', {'id': membre.id}) }}">edit</a>
|
</div>
|
||||||
|
|
||||||
{{ include('membre/_delete_form.html.twig') }}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
4
templates/projet/_delete_form.html.twig
Normal file
4
templates/projet/_delete_form.html.twig
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<form method="post" action="{{ path('app_projet_delete', {'id': projet.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||||
|
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ projet.id) }}">
|
||||||
|
<button class="btn">Delete</button>
|
||||||
|
</form>
|
||||||
4
templates/projet/_form.html.twig
Normal file
4
templates/projet/_form.html.twig
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{{ form_start(form) }}
|
||||||
|
{{ form_widget(form) }}
|
||||||
|
<button class="btn">{{ button_label|default('Save') }}</button>
|
||||||
|
{{ form_end(form) }}
|
||||||
13
templates/projet/edit.html.twig
Normal file
13
templates/projet/edit.html.twig
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}Edit Projet{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>Edit Projet</h1>
|
||||||
|
|
||||||
|
{{ include('projet/_form.html.twig', {'button_label': 'Update'}) }}
|
||||||
|
|
||||||
|
<a href="{{ path('app_projet_index') }}">back to list</a>
|
||||||
|
|
||||||
|
{{ include('projet/_delete_form.html.twig') }}
|
||||||
|
{% endblock %}
|
||||||
35
templates/projet/index.html.twig
Normal file
35
templates/projet/index.html.twig
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}Projet index{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>Projet index</h1>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Id</th>
|
||||||
|
<th>Nom</th>
|
||||||
|
<th>actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for projet in projets %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ projet.id }}</td>
|
||||||
|
<td>{{ projet.nom }}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ path('app_projet_show', {'id': projet.id}) }}">show</a>
|
||||||
|
<a href="{{ path('app_projet_edit', {'id': projet.id}) }}">edit</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% else %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3">no records found</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<a href="{{ path('app_projet_new') }}">Create new</a>
|
||||||
|
{% endblock %}
|
||||||
11
templates/projet/new.html.twig
Normal file
11
templates/projet/new.html.twig
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}New Projet{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>Create new Projet</h1>
|
||||||
|
|
||||||
|
{{ include('projet/_form.html.twig') }}
|
||||||
|
|
||||||
|
<a href="{{ path('app_projet_index') }}">back to list</a>
|
||||||
|
{% endblock %}
|
||||||
26
templates/projet/show.html.twig
Normal file
26
templates/projet/show.html.twig
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}Projet{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>Projet</h1>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>Id</th>
|
||||||
|
<td>{{ projet.id }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Nom</th>
|
||||||
|
<td>{{ projet.nom }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<a href="{{ path('app_projet_index') }}">back to list</a>
|
||||||
|
|
||||||
|
<a href="{{ path('app_projet_edit', {'id': projet.id}) }}">edit</a>
|
||||||
|
|
||||||
|
{{ include('projet/_delete_form.html.twig') }}
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user