mirror of
https://forge.chapril.org/tykayn/caisse-bliss
synced 2025-10-09 17:02:47 +02:00
up templates
This commit is contained in:
parent
71bce538af
commit
a39b6239b0
71 changed files with 1536 additions and 262 deletions
81
src/Controller/CategoryController.php
Normal file
81
src/Controller/CategoryController.php
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Category;
|
||||
use App\Form\CategoryType;
|
||||
use App\Repository\CategoryRepository;
|
||||
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('/category')]
|
||||
final class CategoryController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_category_index', methods: ['GET'])]
|
||||
public function index(CategoryRepository $categoryRepository): Response
|
||||
{
|
||||
return $this->render('category/index.html.twig', [
|
||||
'categories' => $categoryRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_category_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$category = new Category();
|
||||
$form = $this->createForm(CategoryType::class, $category);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($category);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_category_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('category/new.html.twig', [
|
||||
'category' => $category,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_category_show', methods: ['GET'])]
|
||||
public function show(Category $category): Response
|
||||
{
|
||||
return $this->render('category/show.html.twig', [
|
||||
'category' => $category,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_category_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Category $category, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(CategoryType::class, $category);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_category_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('category/edit.html.twig', [
|
||||
'category' => $category,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_category_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Category $category, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$category->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($category);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_category_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
81
src/Controller/ExpenseController.php
Normal file
81
src/Controller/ExpenseController.php
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Expense;
|
||||
use App\Form\ExpenseType;
|
||||
use App\Repository\ExpenseRepository;
|
||||
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('/expense')]
|
||||
final class ExpenseController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_expense_index', methods: ['GET'])]
|
||||
public function index(ExpenseRepository $expenseRepository): Response
|
||||
{
|
||||
return $this->render('expense/index.html.twig', [
|
||||
'expenses' => $expenseRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_expense_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$expense = new Expense();
|
||||
$form = $this->createForm(ExpenseType::class, $expense);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($expense);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_expense_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('expense/new.html.twig', [
|
||||
'expense' => $expense,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_expense_show', methods: ['GET'])]
|
||||
public function show(Expense $expense): Response
|
||||
{
|
||||
return $this->render('expense/show.html.twig', [
|
||||
'expense' => $expense,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_expense_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Expense $expense, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(ExpenseType::class, $expense);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_expense_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('expense/edit.html.twig', [
|
||||
'expense' => $expense,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_expense_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Expense $expense, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$expense->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($expense);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_expense_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
81
src/Controller/FestivalController.php
Normal file
81
src/Controller/FestivalController.php
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Festival;
|
||||
use App\Form\FestivalType;
|
||||
use App\Repository\FestivalRepository;
|
||||
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('/festival')]
|
||||
final class FestivalController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_festival_index', methods: ['GET'])]
|
||||
public function index(FestivalRepository $festivalRepository): Response
|
||||
{
|
||||
return $this->render('festival/index.html.twig', [
|
||||
'festivals' => $festivalRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_festival_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$festival = new Festival();
|
||||
$form = $this->createForm(FestivalType::class, $festival);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($festival);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_festival_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('festival/new.html.twig', [
|
||||
'festival' => $festival,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_festival_show', methods: ['GET'])]
|
||||
public function show(Festival $festival): Response
|
||||
{
|
||||
return $this->render('festival/show.html.twig', [
|
||||
'festival' => $festival,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_festival_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Festival $festival, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(FestivalType::class, $festival);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_festival_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('festival/edit.html.twig', [
|
||||
'festival' => $festival,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_festival_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Festival $festival, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$festival->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($festival);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_festival_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
81
src/Controller/GroupOfProductsController.php
Normal file
81
src/Controller/GroupOfProductsController.php
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\GroupOfProducts;
|
||||
use App\Form\GroupOfProductsType;
|
||||
use App\Repository\GroupOfProductsRepository;
|
||||
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('/group/of/products')]
|
||||
final class GroupOfProductsController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_group_of_products_index', methods: ['GET'])]
|
||||
public function index(GroupOfProductsRepository $groupOfProductsRepository): Response
|
||||
{
|
||||
return $this->render('group_of_products/index.html.twig', [
|
||||
'group_of_products' => $groupOfProductsRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_group_of_products_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$groupOfProduct = new GroupOfProducts();
|
||||
$form = $this->createForm(GroupOfProductsType::class, $groupOfProduct);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($groupOfProduct);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_group_of_products_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('group_of_products/new.html.twig', [
|
||||
'group_of_product' => $groupOfProduct,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_group_of_products_show', methods: ['GET'])]
|
||||
public function show(GroupOfProducts $groupOfProduct): Response
|
||||
{
|
||||
return $this->render('group_of_products/show.html.twig', [
|
||||
'group_of_product' => $groupOfProduct,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_group_of_products_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, GroupOfProducts $groupOfProduct, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(GroupOfProductsType::class, $groupOfProduct);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_group_of_products_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('group_of_products/edit.html.twig', [
|
||||
'group_of_product' => $groupOfProduct,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_group_of_products_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, GroupOfProducts $groupOfProduct, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$groupOfProduct->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($groupOfProduct);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_group_of_products_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
81
src/Controller/ProductController.php
Normal file
81
src/Controller/ProductController.php
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Product;
|
||||
use App\Form\ProductType;
|
||||
use App\Repository\ProductRepository;
|
||||
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('/product')]
|
||||
final class ProductController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_product_index', methods: ['GET'])]
|
||||
public function index(ProductRepository $productRepository): Response
|
||||
{
|
||||
return $this->render('product/index.html.twig', [
|
||||
'products' => $productRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_product_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$product = new Product();
|
||||
$form = $this->createForm(ProductType::class, $product);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($product);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_product_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('product/new.html.twig', [
|
||||
'product' => $product,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_product_show', methods: ['GET'])]
|
||||
public function show(Product $product): Response
|
||||
{
|
||||
return $this->render('product/show.html.twig', [
|
||||
'product' => $product,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_product_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Product $product, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(ProductType::class, $product);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_product_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('product/edit.html.twig', [
|
||||
'product' => $product,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_product_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Product $product, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$product->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($product);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_product_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
81
src/Controller/SellingController.php
Normal file
81
src/Controller/SellingController.php
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Selling;
|
||||
use App\Form\SellingType;
|
||||
use App\Repository\SellingRepository;
|
||||
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('/selling')]
|
||||
final class SellingController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_selling_index', methods: ['GET'])]
|
||||
public function index(SellingRepository $sellingRepository): Response
|
||||
{
|
||||
return $this->render('selling/index.html.twig', [
|
||||
'sellings' => $sellingRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: 'app_selling_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$selling = new Selling();
|
||||
$form = $this->createForm(SellingType::class, $selling);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($selling);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_selling_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('selling/new.html.twig', [
|
||||
'selling' => $selling,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_selling_show', methods: ['GET'])]
|
||||
public function show(Selling $selling): Response
|
||||
{
|
||||
return $this->render('selling/show.html.twig', [
|
||||
'selling' => $selling,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: 'app_selling_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Selling $selling, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(SellingType::class, $selling);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('app_selling_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('selling/edit.html.twig', [
|
||||
'selling' => $selling,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'app_selling_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Selling $selling, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$selling->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($selling);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('app_selling_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
25
src/Form/CategoryType.php
Normal file
25
src/Form/CategoryType.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Category;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class CategoryType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('name')
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Category::class,
|
||||
]);
|
||||
}
|
||||
}
|
26
src/Form/ExpenseType.php
Normal file
26
src/Form/ExpenseType.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Expense;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class ExpenseType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('name')
|
||||
->add('price')
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Expense::class,
|
||||
]);
|
||||
}
|
||||
}
|
31
src/Form/FestivalType.php
Normal file
31
src/Form/FestivalType.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Festival;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class FestivalType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('name')
|
||||
->add('date_start', null, [
|
||||
'widget' => 'single_text',
|
||||
])
|
||||
->add('date_end', null, [
|
||||
'widget' => 'single_text',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Festival::class,
|
||||
]);
|
||||
}
|
||||
}
|
33
src/Form/GroupOfProductsType.php
Normal file
33
src/Form/GroupOfProductsType.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\GroupOfProducts;
|
||||
use App\Entity\Product;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class GroupOfProductsType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('name')
|
||||
->add('products', EntityType::class, [
|
||||
'class' => Product::class,
|
||||
'choice_label' => 'id',
|
||||
'multiple' => true,
|
||||
'required' => false,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => GroupOfProducts::class,
|
||||
]);
|
||||
}
|
||||
}
|
35
src/Form/ProductType.php
Normal file
35
src/Form/ProductType.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\GroupOfProducts;
|
||||
use App\Entity\Product;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class ProductType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('name')
|
||||
->add('price')
|
||||
->add('stock')
|
||||
->add('groupOfProducts', EntityType::class, [
|
||||
'class' => GroupOfProducts::class,
|
||||
'choice_label' => 'id',
|
||||
'multiple' => true,
|
||||
'required' => false,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Product::class,
|
||||
]);
|
||||
}
|
||||
}
|
28
src/Form/SellingType.php
Normal file
28
src/Form/SellingType.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Selling;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class SellingType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('note')
|
||||
->add('products')
|
||||
->add('sum')
|
||||
->add('reduction')
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Selling::class,
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue