Suppression de StatutTables
This commit is contained in:
parent
7665fd4817
commit
8d10914429
@ -1,74 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controller;
|
|
||||||
|
|
||||||
use App\Entity\StatutTables;
|
|
||||||
use App\Form\StatutTablesType;
|
|
||||||
use App\Repository\StatutTablesRepository;
|
|
||||||
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('/statut/tables')]
|
|
||||||
final class StatutTablesController extends AbstractController
|
|
||||||
{
|
|
||||||
#[Route(name: 'app_statut_tables_index', methods: ['GET'])]
|
|
||||||
public function index(StatutTablesRepository $statutTablesRepository): Response
|
|
||||||
{
|
|
||||||
return $this->render('statut_tables/index.html.twig', [
|
|
||||||
'statut_tables' => $statutTablesRepository->findAll(),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[Route('/new', name: 'app_statut_tables_new', methods: ['GET', 'POST'])]
|
|
||||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
|
||||||
{
|
|
||||||
$statutTable = new StatutTables();
|
|
||||||
$form = $this->createForm(StatutTablesType::class, $statutTable);
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
|
||||||
$entityManager->persist($statutTable);
|
|
||||||
$entityManager->flush();
|
|
||||||
|
|
||||||
return $this->redirectToRoute('app_statut_tables_index', [], Response::HTTP_SEE_OTHER);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('statut_tables/new.html.twig', [
|
|
||||||
'statut_table' => $statutTable,
|
|
||||||
'form' => $form,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#[Route('/{id}/edit', name: 'app_statut_tables_edit', methods: ['GET', 'POST'])]
|
|
||||||
public function edit(Request $request, StatutTables $statutTable, EntityManagerInterface $entityManager): Response
|
|
||||||
{
|
|
||||||
$form = $this->createForm(StatutTablesType::class, $statutTable);
|
|
||||||
$form->handleRequest($request);
|
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
|
||||||
$entityManager->flush();
|
|
||||||
|
|
||||||
return $this->redirectToRoute('app_statut_tables_index', [], Response::HTTP_SEE_OTHER);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('statut_tables/edit.html.twig', [
|
|
||||||
'statut_table' => $statutTable,
|
|
||||||
'form' => $form,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[Route('/{id}', name: 'app_statut_tables_delete', methods: ['POST'])]
|
|
||||||
public function delete(Request $request, StatutTables $statutTable, EntityManagerInterface $entityManager): Response
|
|
||||||
{
|
|
||||||
if ($this->isCsrfTokenValid('delete'.$statutTable->getId(), $request->getPayload()->getString('_token'))) {
|
|
||||||
$entityManager->remove($statutTable);
|
|
||||||
$entityManager->flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->redirectToRoute('app_statut_tables_index', [], Response::HTTP_SEE_OTHER);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Entity;
|
|
||||||
|
|
||||||
use App\Repository\StatutTablesRepository;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: StatutTablesRepository::class)]
|
|
||||||
class StatutTables
|
|
||||||
{
|
|
||||||
#[ORM\Id]
|
|
||||||
#[ORM\GeneratedValue]
|
|
||||||
#[ORM\Column]
|
|
||||||
private ?int $id = null;
|
|
||||||
|
|
||||||
#[ORM\Column(length: 255)]
|
|
||||||
private ?string $Libelle = null;
|
|
||||||
|
|
||||||
#[ORM\ManyToOne(inversedBy: 'statutTables')]
|
|
||||||
private ?Tables $tables = null;
|
|
||||||
|
|
||||||
public function getId(): ?int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLibelle(): ?string
|
|
||||||
{
|
|
||||||
return $this->Libelle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setLibelle(string $Libelle): static
|
|
||||||
{
|
|
||||||
$this->Libelle = $Libelle;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTables(): ?Tables
|
|
||||||
{
|
|
||||||
return $this->tables;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setTable(?Tables $tables): static
|
|
||||||
{
|
|
||||||
$this->tables = $tables;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
@ -27,12 +27,6 @@ class Tables
|
|||||||
#[ORM\OneToMany(targetEntity: Reservations::class, mappedBy: 'tables')]
|
#[ORM\OneToMany(targetEntity: Reservations::class, mappedBy: 'tables')]
|
||||||
private Collection $reservations;
|
private Collection $reservations;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var Collection<int, StatutTables>
|
|
||||||
*/
|
|
||||||
#[ORM\OneToMany(targetEntity: StatutTables::class, mappedBy: 'tables')]
|
|
||||||
private Collection $statutTables;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Collection<int, Utilisateurs>
|
* @var Collection<int, Utilisateurs>
|
||||||
*/
|
*/
|
||||||
@ -46,7 +40,6 @@ class Tables
|
|||||||
{
|
{
|
||||||
$this->Clients = new ArrayCollection();
|
$this->Clients = new ArrayCollection();
|
||||||
$this->reservations = new ArrayCollection();
|
$this->reservations = new ArrayCollection();
|
||||||
$this->statutTables = new ArrayCollection();
|
|
||||||
$this->utilisateurs = new ArrayCollection();
|
$this->utilisateurs = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,36 +105,6 @@ class Tables
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Collection<int, StatutTables>
|
|
||||||
*/
|
|
||||||
public function getStatutTables(): Collection
|
|
||||||
{
|
|
||||||
return $this->statutTables;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addStatutTable(StatutTables $statutTable): static
|
|
||||||
{
|
|
||||||
if (!$this->statutTables->contains($statutTable)) {
|
|
||||||
$this->statutTables->add($statutTable);
|
|
||||||
$statutTable->setTable($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removeStatutTable(StatutTables $statutTable): static
|
|
||||||
{
|
|
||||||
if ($this->statutTables->removeElement($statutTable)) {
|
|
||||||
// set the owning side to null (unless already changed)
|
|
||||||
if ($statutTable->getTables() === $this) {
|
|
||||||
$statutTable->setTable(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection<int, Utilisateurs>
|
* @return Collection<int, Utilisateurs>
|
||||||
*/
|
*/
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Form;
|
|
||||||
|
|
||||||
use App\Entity\StatutTables;
|
|
||||||
use App\Entity\Tables;
|
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
||||||
|
|
||||||
class StatutTablesType extends AbstractType
|
|
||||||
{
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
|
||||||
{
|
|
||||||
$builder
|
|
||||||
->add('Libelle')
|
|
||||||
->add('tables', EntityType::class, [
|
|
||||||
'class' => Tables::class,
|
|
||||||
'choice_label' => 'id',
|
|
||||||
'mapped' => false,
|
|
||||||
])
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver): void
|
|
||||||
{
|
|
||||||
$resolver->setDefaults([
|
|
||||||
'data_class' => StatutTables::class,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Repository;
|
|
||||||
|
|
||||||
use App\Entity\StatutTables;
|
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @extends ServiceEntityRepository<StatutTables>
|
|
||||||
*/
|
|
||||||
class StatutTablesRepository extends ServiceEntityRepository
|
|
||||||
{
|
|
||||||
public function __construct(ManagerRegistry $registry)
|
|
||||||
{
|
|
||||||
parent::__construct($registry, StatutTables::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * @return StatutTables[] Returns an array of StatutTables objects
|
|
||||||
// */
|
|
||||||
// public function findByExampleField($value): array
|
|
||||||
// {
|
|
||||||
// return $this->createQueryBuilder('s')
|
|
||||||
// ->andWhere('s.exampleField = :val')
|
|
||||||
// ->setParameter('val', $value)
|
|
||||||
// ->orderBy('s.id', 'ASC')
|
|
||||||
// ->setMaxResults(10)
|
|
||||||
// ->getQuery()
|
|
||||||
// ->getResult()
|
|
||||||
// ;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public function findOneBySomeField($value): ?StatutTables
|
|
||||||
// {
|
|
||||||
// return $this->createQueryBuilder('s')
|
|
||||||
// ->andWhere('s.exampleField = :val')
|
|
||||||
// ->setParameter('val', $value)
|
|
||||||
// ->getQuery()
|
|
||||||
// ->getOneOrNullResult()
|
|
||||||
// ;
|
|
||||||
// }
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
<form method="post" action="{{ path('app_statut_tables_delete', {'id': statut_table.id}) }}" onsubmit="return confirm('Es-tu sur de vouloir le supprimer ?');">
|
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ statut_table.id) }}">
|
|
||||||
<button class="btn">Supprimer</button>
|
|
||||||
</form>
|
|
@ -1,4 +0,0 @@
|
|||||||
{{ form_start(form) }}
|
|
||||||
{{ form_widget(form) }}
|
|
||||||
<button class="btn">{{ button_label|default('Sauvegarder') }}</button>
|
|
||||||
{{ form_end(form) }}
|
|
@ -1,23 +0,0 @@
|
|||||||
{% extends 'base.html.twig' %}
|
|
||||||
|
|
||||||
{% block title %}Edit Statut tables{% endblock %}
|
|
||||||
|
|
||||||
{% block stylesheets %}
|
|
||||||
<div class="page-container">
|
|
||||||
<h1 class="page-title">Modifier Statut tables</h1>
|
|
||||||
|
|
||||||
{{ include('statut_tables/_form.html.twig', {'button_label': 'Mettre à jour'}) }}
|
|
||||||
|
|
||||||
<div class="actions">
|
|
||||||
{{ include('statut_tables/_delete_form.html.twig') }}
|
|
||||||
<br>
|
|
||||||
<a href="{{ path('app_statut_tables_index') }}">Retour à la liste</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
<link rel="stylesheet" href="{{ asset('css/ControllerVues/edit.css') }}">
|
|
||||||
{% endblock %}
|
|
@ -1,41 +0,0 @@
|
|||||||
{% extends 'base.html.twig' %}
|
|
||||||
|
|
||||||
{% block title %}StatutTables index{% endblock %}
|
|
||||||
{% block stylesheets %}
|
|
||||||
<link rel="stylesheet" href="{{ asset('css/ControllerVues/list.css') }}"> <!-- Ajout du fichier CSS -->
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
{% block body %}
|
|
||||||
<h1>StatutTables index</h1>
|
|
||||||
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<th>Libellé</th>
|
|
||||||
<th>actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for statut_table in statut_tables %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ statut_table.id }}</td>
|
|
||||||
<td>{{ statut_table.Libelle}}</td>
|
|
||||||
<td>
|
|
||||||
<form method="post" action="{{ path('app_statut_tables_delete', {'id': statut_table.id}) }}" onsubmit="return confirm('Es-tu sur de vouloir le supprimer ?');">
|
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ statut_table.id) }}">
|
|
||||||
{{ include('statut_tables/_delete_form.html.twig') }}
|
|
||||||
</form>
|
|
||||||
<a href="{{ path('app_statut_tables_edit', {'id': statut_table.id}) }}">Modifier</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% else %}
|
|
||||||
<tr>
|
|
||||||
<td colspan="3">Aucun enregistrement trouvé</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<a href="{{ path('app_statut_tables_new') }}">Créer un nouveau</a>
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends 'base.html.twig' %}
|
|
||||||
|
|
||||||
{% block title %}Créer un nouveau StatutTables{% endblock %}
|
|
||||||
{% block stylesheets %}
|
|
||||||
<link rel="stylesheet" href="{{ asset('css/ControllerVues/new.css') }}"> <!-- Ajout du fichier CSS -->
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
{% block body %}
|
|
||||||
<h1>Créer un nouveau StatutTables</h1>
|
|
||||||
|
|
||||||
{{ include('statut_tables/_form.html.twig') }}
|
|
||||||
<div class="actions">
|
|
||||||
<a href="{{ path('app_statut_tables_index') }}">Retour à la liste</a>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
@ -1,29 +0,0 @@
|
|||||||
{% extends 'base.html.twig' %}
|
|
||||||
|
|
||||||
{% block title %}StatutTables{% endblock %}
|
|
||||||
{% block stylesheets %}
|
|
||||||
<link rel="stylesheet" href="{{ asset('css/show.css') }}"> <!-- Ajout du fichier CSS -->
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
{% block body %}
|
|
||||||
<h1>StatutTables</h1>
|
|
||||||
|
|
||||||
<table class="table">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th>Id</th>
|
|
||||||
<td>{{ statut_table.id }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Libellé</th>
|
|
||||||
<td>{{ statut_table.Libelle }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<a href="{{ path('app_statut_tables_index') }}">back to list</a>
|
|
||||||
|
|
||||||
<a href="{{ path('app_statut_tables_edit', {'id': statut_table.id}) }}">edit</a>
|
|
||||||
|
|
||||||
{{ include('statut_tables/_delete_form.html.twig') }}
|
|
||||||
{% endblock %}
|
|
Loading…
x
Reference in New Issue
Block a user