From 74f8c138e3158aaef68d8f6c6c5acc806e598414 Mon Sep 17 00:00:00 2001 From: Mounouar Othmane <mounouar21@gmail.com> Date: Sun, 23 Mar 2025 15:44:55 +0100 Subject: [PATCH] creating wishlist --- src/Entity/Wishlist.php | 66 +++++++++++++++++++++++++++ src/Repository/WishlistRepository.php | 43 +++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 src/Entity/Wishlist.php create mode 100644 src/Repository/WishlistRepository.php diff --git a/src/Entity/Wishlist.php b/src/Entity/Wishlist.php new file mode 100644 index 00000000..f06e40e1 --- /dev/null +++ b/src/Entity/Wishlist.php @@ -0,0 +1,66 @@ +<?php + +namespace App\Entity; + +use App\Repository\WishlistRepository; +use Doctrine\DBAL\Types\Types; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: WishlistRepository::class)] +class Wishlist +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\Column(length: 255)] + private ?string $name = null; + + #[ORM\Column(type: Types::DATETIME_MUTABLE)] + private ?\DateTimeInterface $deadline = null; + + #[ORM\Column] + private ?bool $isDisabled = null; + + public function getId(): ?int + { + return $this->id; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): static + { + $this->name = $name; + + return $this; + } + + public function getDeadline(): ?\DateTimeInterface + { + return $this->deadline; + } + + public function setDeadline(\DateTimeInterface $deadline): static + { + $this->deadline = $deadline; + + return $this; + } + + public function isDisabled(): ?bool + { + return $this->isDisabled; + } + + public function setIsDisabled(bool $isDisabled): static + { + $this->isDisabled = $isDisabled; + + return $this; + } +} diff --git a/src/Repository/WishlistRepository.php b/src/Repository/WishlistRepository.php new file mode 100644 index 00000000..fd0dc02c --- /dev/null +++ b/src/Repository/WishlistRepository.php @@ -0,0 +1,43 @@ +<?php + +namespace App\Repository; + +use App\Entity\Wishlist; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<Wishlist> + */ +class WishlistRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Wishlist::class); + } + + // /** + // * @return Wishlist[] Returns an array of Wishlist objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('w') + // ->andWhere('w.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('w.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } + + // public function findOneBySomeField($value): ?Wishlist + // { + // return $this->createQueryBuilder('w') + // ->andWhere('w.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +} -- GitLab