From cb0297979172a880b4fd9670ca3d19539d283748 Mon Sep 17 00:00:00 2001 From: Zahdi <ZahdiMohcine20@gmail.com> Date: Sun, 23 Mar 2025 15:48:33 +0100 Subject: [PATCH] [Progress] merging my local changes --- archive/Invitation.php | 65 ++++++++++++++++++++++++++ archive/InvitationRepository.php | 43 +++++++++++++++++ archive/InvitationsController.php | 34 ++++++++++++++ composer.json | 2 +- composer.lock | 2 +- src/Controller/WhishlistController.php | 2 +- 6 files changed, 145 insertions(+), 3 deletions(-) create mode 100644 archive/Invitation.php create mode 100644 archive/InvitationRepository.php create mode 100644 archive/InvitationsController.php diff --git a/archive/Invitation.php b/archive/Invitation.php new file mode 100644 index 00000000..dee35197 --- /dev/null +++ b/archive/Invitation.php @@ -0,0 +1,65 @@ +<?php + +namespace App\Entity; + +use App\Repository\InvitationRepository; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: InvitationRepository::class)] +class Invitation +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\Column] + private ?int $userId = null; + + #[ORM\Column] + private ?bool $state = null; + + #[ORM\Column] + private ?int $wishlistId = null; + + public function getId(): ?int + { + return $this->id; + } + + public function getUserId(): ?int + { + return $this->userId; + } + + public function setUserId(int $userId): static + { + $this->userId = $userId; + + return $this; + } + + public function isState(): ?bool + { + return $this->state; + } + + public function setState(bool $state): static + { + $this->state = $state; + + return $this; + } + + public function getWishlistId(): ?int + { + return $this->wishlistId; + } + + public function setWishlistId(int $wishlistId): static + { + $this->wishlistId = $wishlistId; + + return $this; + } +} diff --git a/archive/InvitationRepository.php b/archive/InvitationRepository.php new file mode 100644 index 00000000..8cea308c --- /dev/null +++ b/archive/InvitationRepository.php @@ -0,0 +1,43 @@ +<?php + +namespace App\Repository; + +use App\Entity\Invitation; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<Invitation> + */ +class InvitationRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Invitation::class); + } + + // /** + // * @return Invitation[] Returns an array of Invitation objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('i') + // ->andWhere('i.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('i.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } + + // public function findOneBySomeField($value): ?Invitation + // { + // return $this->createQueryBuilder('i') + // ->andWhere('i.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +} diff --git a/archive/InvitationsController.php b/archive/InvitationsController.php new file mode 100644 index 00000000..1b04522e --- /dev/null +++ b/archive/InvitationsController.php @@ -0,0 +1,34 @@ + +<?php + + +use App\Repository\InvitationRepository; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Attribute\Route; + + +#[Route('/wishlist')] +class InvitationsController extends AbstractController{ + + #[Route(path:'', name:'')] + + public function createInvitation( Request $request , InvitationRepository $invitationRepository): Response { + $userId = $request->get("userId") ; + $state = $request->get("state") ; + $wishlistId = $request->get("wishlistId") ; + $invitationRepository->createInvitation($userId, $state, $wishlistId); + // return $this->render("") + + + } + + + +} + + + +?> + diff --git a/composer.json b/composer.json index e4be7458..93f812a3 100644 --- a/composer.json +++ b/composer.json @@ -44,7 +44,7 @@ "symfony/yaml": "7.2.*", "twig/extra-bundle": "^2.12|^3.0", "twig/twig": "^2.12|^3.0", - "vich/uploader-bundle": "^2.5" + "vich/uploader-bundle": "*" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index c0551765..10f43b90 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b2ee6e5d461f24017c9b451bcf06e3f1", + "content-hash": "01540afce6c9a8bebceb9abc5ca2196f", "packages": [ { "name": "composer/semver", diff --git a/src/Controller/WhishlistController.php b/src/Controller/WhishlistController.php index 21237de6..4709e430 100644 --- a/src/Controller/WhishlistController.php +++ b/src/Controller/WhishlistController.php @@ -11,7 +11,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; -#[Route('/whishlist')] +#[Route('/wishlist')] final class WhishlistController extends AbstractController { #[Route(name: 'app_whishlist_index', methods: ['GET'])] -- GitLab