ajout des cotroleur avec template pour les entitys
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Categorie;
|
||||
use App\Form\CategorieType;
|
||||
use App\Repository\CategorieRepository;
|
||||
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('/categorie')]
|
||||
final class CategorieController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_categorie_index', methods: ['GET'])]
|
||||
public function index(CategorieRepository $categorieRepository): Response
|
||||
{
|
||||
return $this->render('categorie/index.html.twig', [
|
||||
'categories' => $categorieRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_categorie_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$categorie = new Categorie();
|
||||
$form = $this->createForm(CategorieType::class, $categorie);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($categorie);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_categorie_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('categorie/new.html.twig', [
|
||||
'categorie' => $categorie,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_categorie_show', methods: ['GET'])]
|
||||
public function show(Categorie $categorie): Response
|
||||
{
|
||||
return $this->render('categorie/show.html.twig', [
|
||||
'categorie' => $categorie,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_categorie_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Categorie $categorie, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(CategorieType::class, $categorie);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_categorie_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('categorie/edit.html.twig', [
|
||||
'categorie' => $categorie,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_categorie_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Categorie $categorie, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$categorie->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($categorie);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_categorie_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Menu;
|
||||
use App\Form\MenuType;
|
||||
use App\Repository\MenuRepository;
|
||||
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('/menu')]
|
||||
final class MenuController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_menu_index', methods: ['GET'])]
|
||||
public function index(MenuRepository $menuRepository): Response
|
||||
{
|
||||
return $this->render('menu/index.html.twig', [
|
||||
'menus' => $menuRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_menu_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$menu = new Menu();
|
||||
$form = $this->createForm(MenuType::class, $menu);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($menu);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_menu_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('menu/new.html.twig', [
|
||||
'menu' => $menu,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_menu_show', methods: ['GET'])]
|
||||
public function show(Menu $menu): Response
|
||||
{
|
||||
return $this->render('menu/show.html.twig', [
|
||||
'menu' => $menu,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_menu_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Menu $menu, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(MenuType::class, $menu);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_menu_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('menu/edit.html.twig', [
|
||||
'menu' => $menu,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_menu_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Menu $menu, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$menu->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($menu);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_menu_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Plat;
|
||||
use App\Form\PlatType;
|
||||
use App\Repository\PlatRepository;
|
||||
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('/plat')]
|
||||
final class PlatController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_plat_index', methods: ['GET'])]
|
||||
public function index(PlatRepository $platRepository): Response
|
||||
{
|
||||
return $this->render('plat/index.html.twig', [
|
||||
'plats' => $platRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_plat_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$plat = new Plat();
|
||||
$form = $this->createForm(PlatType::class, $plat);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($plat);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_plat_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('plat/new.html.twig', [
|
||||
'plat' => $plat,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_plat_show', methods: ['GET'])]
|
||||
public function show(Plat $plat): Response
|
||||
{
|
||||
return $this->render('plat/show.html.twig', [
|
||||
'plat' => $plat,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_plat_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Plat $plat, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(PlatType::class, $plat);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_plat_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('plat/edit.html.twig', [
|
||||
'plat' => $plat,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_plat_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Plat $plat, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$plat->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($plat);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_plat_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Restaurant;
|
||||
use App\Form\RestaurantType;
|
||||
use App\Repository\RestaurantRepository;
|
||||
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('/restaurant')]
|
||||
final class RestaurantController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_restaurant_index', methods: ['GET'])]
|
||||
public function index(RestaurantRepository $restaurantRepository): Response
|
||||
{
|
||||
return $this->render('restaurant/index.html.twig', [
|
||||
'restaurants' => $restaurantRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_restaurant_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$restaurant = new Restaurant();
|
||||
$form = $this->createForm(RestaurantType::class, $restaurant);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($restaurant);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_restaurant_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('restaurant/new.html.twig', [
|
||||
'restaurant' => $restaurant,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_restaurant_show', methods: ['GET'])]
|
||||
public function show(Restaurant $restaurant): Response
|
||||
{
|
||||
return $this->render('restaurant/show.html.twig', [
|
||||
'restaurant' => $restaurant,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_restaurant_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Restaurant $restaurant, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(RestaurantType::class, $restaurant);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_restaurant_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('restaurant/edit.html.twig', [
|
||||
'restaurant' => $restaurant,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_restaurant_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Restaurant $restaurant, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$restaurant->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($restaurant);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_restaurant_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Categorie;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class CategorieType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('nom')
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Categorie::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Menu;
|
||||
use App\Entity\plat;
|
||||
use App\Entity\Restaurant;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class MenuType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('nom')
|
||||
->add('dateDeCreation', null, [
|
||||
'widget' => 'single_text',
|
||||
])
|
||||
->add('plats', EntityType::class, [
|
||||
'class' => plat::class,
|
||||
'choice_label' => 'id',
|
||||
'multiple' => true,
|
||||
])
|
||||
->add('restaurant', EntityType::class, [
|
||||
'class' => Restaurant::class,
|
||||
'choice_label' => 'id',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Menu::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\categorie;
|
||||
use App\Entity\Menu;
|
||||
use App\Entity\Plat;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class PlatType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('nom')
|
||||
->add('description')
|
||||
->add('prix')
|
||||
->add('categorie', EntityType::class, [
|
||||
'class' => categorie::class,
|
||||
'choice_label' => 'id',
|
||||
])
|
||||
->add('menus', EntityType::class, [
|
||||
'class' => Menu::class,
|
||||
'choice_label' => 'id',
|
||||
'multiple' => true,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Plat::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Restaurant;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class RestaurantType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('nom')
|
||||
->add('adresse')
|
||||
->add('telephone')
|
||||
->add('chef')
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Restaurant::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<form method="post" action="{{ path('app_categorie_delete', {'id': categorie.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ categorie.id) }}">
|
||||
<button class="btn">Delete</button>
|
||||
</form>
|
||||
@@ -0,0 +1,4 @@
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<button class="btn">{{ button_label|default('Save') }}</button>
|
||||
{{ form_end(form) }}
|
||||
@@ -0,0 +1,13 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Edit Categorie{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Edit Categorie</h1>
|
||||
|
||||
{{ include('categorie/_form.html.twig', {'button_label': 'Update'}) }}
|
||||
|
||||
<a href="{{ path('app_categorie_index') }}">back to list</a>
|
||||
|
||||
{{ include('categorie/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,35 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Categorie index{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Categorie index</h1>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Nom</th>
|
||||
<th>actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for categorie in categories %}
|
||||
<tr>
|
||||
<td>{{ categorie.id }}</td>
|
||||
<td>{{ categorie.nom }}</td>
|
||||
<td>
|
||||
<a href="{{ path('app_categorie_show', {'id': categorie.id}) }}">show</a>
|
||||
<a href="{{ path('app_categorie_edit', {'id': categorie.id}) }}">edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="3">no records found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('app_categorie_new') }}">Create new</a>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,11 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}New Categorie{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Create new Categorie</h1>
|
||||
|
||||
{{ include('categorie/_form.html.twig') }}
|
||||
|
||||
<a href="{{ path('app_categorie_index') }}">back to list</a>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,26 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Categorie{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Categorie</h1>
|
||||
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<td>{{ categorie.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<td>{{ categorie.nom }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('app_categorie_index') }}">back to list</a>
|
||||
|
||||
<a href="{{ path('app_categorie_edit', {'id': categorie.id}) }}">edit</a>
|
||||
|
||||
{{ include('categorie/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,4 @@
|
||||
<form method="post" action="{{ path('app_menu_delete', {'id': menu.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ menu.id) }}">
|
||||
<button class="btn">Delete</button>
|
||||
</form>
|
||||
@@ -0,0 +1,4 @@
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<button class="btn">{{ button_label|default('Save') }}</button>
|
||||
{{ form_end(form) }}
|
||||
@@ -0,0 +1,13 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Edit Menu{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Edit Menu</h1>
|
||||
|
||||
{{ include('menu/_form.html.twig', {'button_label': 'Update'}) }}
|
||||
|
||||
<a href="{{ path('app_menu_index') }}">back to list</a>
|
||||
|
||||
{{ include('menu/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,37 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Menu index{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Menu index</h1>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Nom</th>
|
||||
<th>DateDeCreation</th>
|
||||
<th>actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for menu in menus %}
|
||||
<tr>
|
||||
<td>{{ menu.id }}</td>
|
||||
<td>{{ menu.nom }}</td>
|
||||
<td>{{ menu.dateDeCreation ? menu.dateDeCreation|date('Y-m-d H:i:s') : '' }}</td>
|
||||
<td>
|
||||
<a href="{{ path('app_menu_show', {'id': menu.id}) }}">show</a>
|
||||
<a href="{{ path('app_menu_edit', {'id': menu.id}) }}">edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="4">no records found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('app_menu_new') }}">Create new</a>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,11 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}New Menu{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Create new Menu</h1>
|
||||
|
||||
{{ include('menu/_form.html.twig') }}
|
||||
|
||||
<a href="{{ path('app_menu_index') }}">back to list</a>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,30 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Menu{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Menu</h1>
|
||||
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<td>{{ menu.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<td>{{ menu.nom }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>DateDeCreation</th>
|
||||
<td>{{ menu.dateDeCreation ? menu.dateDeCreation|date('Y-m-d H:i:s') : '' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('app_menu_index') }}">back to list</a>
|
||||
|
||||
<a href="{{ path('app_menu_edit', {'id': menu.id}) }}">edit</a>
|
||||
|
||||
{{ include('menu/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,4 @@
|
||||
<form method="post" action="{{ path('app_plat_delete', {'id': plat.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ plat.id) }}">
|
||||
<button class="btn">Delete</button>
|
||||
</form>
|
||||
@@ -0,0 +1,4 @@
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<button class="btn">{{ button_label|default('Save') }}</button>
|
||||
{{ form_end(form) }}
|
||||
@@ -0,0 +1,13 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Edit Plat{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Edit Plat</h1>
|
||||
|
||||
{{ include('plat/_form.html.twig', {'button_label': 'Update'}) }}
|
||||
|
||||
<a href="{{ path('app_plat_index') }}">back to list</a>
|
||||
|
||||
{{ include('plat/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,39 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Plat index{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Plat index</h1>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Nom</th>
|
||||
<th>Description</th>
|
||||
<th>Prix</th>
|
||||
<th>actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for plat in plats %}
|
||||
<tr>
|
||||
<td>{{ plat.id }}</td>
|
||||
<td>{{ plat.nom }}</td>
|
||||
<td>{{ plat.description }}</td>
|
||||
<td>{{ plat.prix }}</td>
|
||||
<td>
|
||||
<a href="{{ path('app_plat_show', {'id': plat.id}) }}">show</a>
|
||||
<a href="{{ path('app_plat_edit', {'id': plat.id}) }}">edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="5">no records found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('app_plat_new') }}">Create new</a>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,11 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}New Plat{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Create new Plat</h1>
|
||||
|
||||
{{ include('plat/_form.html.twig') }}
|
||||
|
||||
<a href="{{ path('app_plat_index') }}">back to list</a>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,34 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Plat{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Plat</h1>
|
||||
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<td>{{ plat.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<td>{{ plat.nom }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Description</th>
|
||||
<td>{{ plat.description }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Prix</th>
|
||||
<td>{{ plat.prix }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('app_plat_index') }}">back to list</a>
|
||||
|
||||
<a href="{{ path('app_plat_edit', {'id': plat.id}) }}">edit</a>
|
||||
|
||||
{{ include('plat/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,4 @@
|
||||
<form method="post" action="{{ path('app_restaurant_delete', {'id': restaurant.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ restaurant.id) }}">
|
||||
<button class="btn">Delete</button>
|
||||
</form>
|
||||
@@ -0,0 +1,4 @@
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<button class="btn">{{ button_label|default('Save') }}</button>
|
||||
{{ form_end(form) }}
|
||||
@@ -0,0 +1,13 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Edit Restaurant{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Edit Restaurant</h1>
|
||||
|
||||
{{ include('restaurant/_form.html.twig', {'button_label': 'Update'}) }}
|
||||
|
||||
<a href="{{ path('app_restaurant_index') }}">back to list</a>
|
||||
|
||||
{{ include('restaurant/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,41 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Restaurant index{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Restaurant index</h1>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Nom</th>
|
||||
<th>Adresse</th>
|
||||
<th>Telephone</th>
|
||||
<th>Chef</th>
|
||||
<th>actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for restaurant in restaurants %}
|
||||
<tr>
|
||||
<td>{{ restaurant.id }}</td>
|
||||
<td>{{ restaurant.nom }}</td>
|
||||
<td>{{ restaurant.adresse }}</td>
|
||||
<td>{{ restaurant.telephone }}</td>
|
||||
<td>{{ restaurant.chef }}</td>
|
||||
<td>
|
||||
<a href="{{ path('app_restaurant_show', {'id': restaurant.id}) }}">show</a>
|
||||
<a href="{{ path('app_restaurant_edit', {'id': restaurant.id}) }}">edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="6">no records found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('app_restaurant_new') }}">Create new</a>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,11 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}New Restaurant{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Create new Restaurant</h1>
|
||||
|
||||
{{ include('restaurant/_form.html.twig') }}
|
||||
|
||||
<a href="{{ path('app_restaurant_index') }}">back to list</a>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,38 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Restaurant{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Restaurant</h1>
|
||||
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<td>{{ restaurant.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<td>{{ restaurant.nom }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Adresse</th>
|
||||
<td>{{ restaurant.adresse }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Telephone</th>
|
||||
<td>{{ restaurant.telephone }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Chef</th>
|
||||
<td>{{ restaurant.chef }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('app_restaurant_index') }}">back to list</a>
|
||||
|
||||
<a href="{{ path('app_restaurant_edit', {'id': restaurant.id}) }}">edit</a>
|
||||
|
||||
{{ include('restaurant/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user