diff --git a/README.md b/README.md index 84a9d0efc73c00dee4e40d8817cbc2aed69833aa..80897c030a514d5ea6c3020ca6a98c991c9a5c3a 100644 --- a/README.md +++ b/README.md @@ -12,5 +12,19 @@ composer require --dev symfony/maker-bundle php bin/console doctrine:database:create php bin/console make:migration php bin/console doctrine:migrations:migrate +``` + +Create an entity +``` +docker exec -it symfony_app php bin/console make:entity +``` +Create migration file to apply in the dp +``` +docker exec -it symfony_app php bin/console make:migration +``` + +Apply the migration file in the db +``` +docker exec -it symfony_app php bin/console doctrine:migrations:migrate ``` \ No newline at end of file diff --git a/web_app/migrations/Version20250221203107.php b/web_app/migrations/Version20250221203107.php deleted file mode 100644 index 10602e831e4b5a634b3c2313b51843fa18b027bd..0000000000000000000000000000000000000000 --- a/web_app/migrations/Version20250221203107.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace DoctrineMigrations; - -use Doctrine\DBAL\Schema\Schema; -use Doctrine\Migrations\AbstractMigration; - -/** - * Auto-generated Migration: Please modify to your needs! - */ -final class Version20250221203107 extends AbstractMigration -{ - public function getDescription(): string - { - return ''; - } - - public function up(Schema $schema): void - { - // this up() migration is auto-generated, please modify it to your needs - $this->addSql('CREATE TABLE product (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, price DOUBLE PRECISION NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('DROP TABLE product'); - } -} diff --git a/web_app/migrations/Version20250223144640.php b/web_app/migrations/Version20250223144640.php new file mode 100644 index 0000000000000000000000000000000000000000..a3abef2073b2dba6efe635c8eed558927dcd89ef --- /dev/null +++ b/web_app/migrations/Version20250223144640.php @@ -0,0 +1,41 @@ +<?php + +declare(strict_types=1); + +namespace DoctrineMigrations; + +use Doctrine\DBAL\Schema\Schema; +use Doctrine\Migrations\AbstractMigration; + +/** + * Auto-generated Migration: Please modify to your needs! + */ +final class Version20250223144640 extends AbstractMigration +{ + public function getDescription(): string + { + return ''; + } + + public function up(Schema $schema): void + { + // this up() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE TABLE item (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, price DOUBLE PRECISION NOT NULL, purchase_url VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE purchase (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, wishlist_id INT NOT NULL, item_id INT NOT NULL, url_proof VARCHAR(255) DEFAULT NULL, message VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, user_name VARCHAR(255) DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, surname VARCHAR(255) DEFAULT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, is_blocked TINYINT(1) DEFAULT NULL, role VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE wish_list (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, name VARCHAR(255) NOT NULL, expiration_date DATETIME DEFAULT NULL, is_active TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE wish_list_item (id INT AUTO_INCREMENT NOT NULL, wishlist_id INT NOT NULL, item_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE wish_list_member (id INT AUTO_INCREMENT NOT NULL, wishlist_id INT NOT NULL, user_id INT NOT NULL, can_edit TINYINT(1) NOT NULL, is_accepted TINYINT(1) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('DROP TABLE item'); + $this->addSql('DROP TABLE purchase'); + $this->addSql('DROP TABLE user'); + $this->addSql('DROP TABLE wish_list'); + $this->addSql('DROP TABLE wish_list_item'); + $this->addSql('DROP TABLE wish_list_member'); + } +} diff --git a/web_app/src/Entity/Item.php b/web_app/src/Entity/Item.php new file mode 100644 index 0000000000000000000000000000000000000000..2f8bea58aae5fed27afc3dde548cabf2b7161137 --- /dev/null +++ b/web_app/src/Entity/Item.php @@ -0,0 +1,102 @@ +<?php + +namespace App\Entity; + +use App\Repository\ItemRepository; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: ItemRepository::class)] +class Item +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\Column(length: 255)] + private ?string $title = null; + + #[ORM\Column(length: 255, nullable: true)] + private ?string $description = null; + + #[ORM\Column] + private ?float $price = null; + + #[ORM\Column(length: 255, nullable: true)] + private ?string $purchase_url = null; + + #[ORM\Column] + private ?\DateTimeImmutable $created_at = null; + + public function getId(): ?int + { + return $this->id; + } + + public function setId(int $id): static + { + $this->id = $id; + + return $this; + } + + public function getTitle(): ?string + { + return $this->title; + } + + public function setTitle(string $title): static + { + $this->title = $title; + + return $this; + } + + public function getDescription(): ?string + { + return $this->description; + } + + public function setDescription(?string $description): static + { + $this->description = $description; + + return $this; + } + + public function getPrice(): ?float + { + return $this->price; + } + + public function setPrice(float $price): static + { + $this->price = $price; + + return $this; + } + + public function getPurchaseUrl(): ?string + { + return $this->purchase_url; + } + + public function setPurchaseUrl(?string $purchase_url): static + { + $this->purchase_url = $purchase_url; + + return $this; + } + + public function getCreatedAt(): ?\DateTimeImmutable + { + return $this->created_at; + } + + public function setCreatedAt(\DateTimeImmutable $created_at): static + { + $this->created_at = $created_at; + + return $this; + } +} diff --git a/web_app/src/Entity/Product.php b/web_app/src/Entity/Product.php deleted file mode 100644 index b78a233594416da1c4612af82dc8cd06eed9c32e..0000000000000000000000000000000000000000 --- a/web_app/src/Entity/Product.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php - -namespace App\Entity; - -use App\Repository\ProductRepository; -use Doctrine\ORM\Mapping as ORM; - -#[ORM\Entity(repositoryClass: ProductRepository::class)] -class Product -{ - #[ORM\Id] - #[ORM\GeneratedValue] - #[ORM\Column] - private ?int $id = null; - - #[ORM\Column(length: 255)] - private ?string $name = null; - - #[ORM\Column] - private ?float $price = 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 getPrice(): ?float - { - return $this->price; - } - - public function setPrice(float $price): static - { - $this->price = $price; - - return $this; - } -} diff --git a/web_app/src/Entity/Purchase.php b/web_app/src/Entity/Purchase.php new file mode 100644 index 0000000000000000000000000000000000000000..14a31b97063e1a81883cc352f12825d7f9ff2124 --- /dev/null +++ b/web_app/src/Entity/Purchase.php @@ -0,0 +1,117 @@ +<?php + +namespace App\Entity; + +use App\Repository\PurchaseRepository; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: PurchaseRepository::class)] +class Purchase +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\Column] + private ?int $user_id = null; + + #[ORM\Column] + private ?int $wishlist_id = null; + + #[ORM\Column] + private ?int $item_id = null; + + #[ORM\Column(length: 255, nullable: true)] + private ?string $url_proof = null; + + #[ORM\Column(length: 255, nullable: true)] + private ?string $message = null; + + #[ORM\Column] + private ?\DateTimeImmutable $created_at = null; + + public function getId(): ?int + { + return $this->id; + } + + public function setId(int $id): static + { + $this->id = $id; + + return $this; + } + + public function getUserId(): ?int + { + return $this->user_id; + } + + public function setUserId(int $user_id): static + { + $this->user_id = $user_id; + + return $this; + } + + public function getWishlistId(): ?int + { + return $this->wishlist_id; + } + + public function setWishlistId(int $wishlist_id): static + { + $this->wishlist_id = $wishlist_id; + + return $this; + } + + public function getItemId(): ?int + { + return $this->item_id; + } + + public function setItemId(int $item_id): static + { + $this->item_id = $item_id; + + return $this; + } + + public function getUrlProof(): ?string + { + return $this->url_proof; + } + + public function setUrlProof(?string $url_proof): static + { + $this->url_proof = $url_proof; + + return $this; + } + + public function getMessage(): ?string + { + return $this->message; + } + + public function setMessage(?string $message): static + { + $this->message = $message; + + return $this; + } + + public function getCreatedAt(): ?\DateTimeImmutable + { + return $this->created_at; + } + + public function setCreatedAt(\DateTimeImmutable $created_at): static + { + $this->created_at = $created_at; + + return $this; + } +} diff --git a/web_app/src/Entity/User.php b/web_app/src/Entity/User.php new file mode 100644 index 0000000000000000000000000000000000000000..f3427bebf582d0ffd4690107e593defea5dae0e2 --- /dev/null +++ b/web_app/src/Entity/User.php @@ -0,0 +1,148 @@ +<?php + +namespace App\Entity; + +use App\Enum\UserRole; +use App\Repository\UserRepository; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: UserRepository::class)] +class User +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\Column(length: 255, nullable: true)] + private ?string $user_name = null; + + #[ORM\Column(length: 255, nullable: true)] + private ?string $name = null; + + #[ORM\Column(length: 255, nullable: true)] + private ?string $surname = null; + + #[ORM\Column(length: 255)] + private ?string $email = null; + + #[ORM\Column(length: 255)] + private ?string $password = null; + + #[ORM\Column(nullable: true)] + private ?bool $is_blocked = null; + + #[ORM\Column(enumType: UserRole::class)] + private ?UserRole $role = null; + + #[ORM\Column] + private ?\DateTimeImmutable $created_at = null; + + public function getId(): ?int + { + return $this->id; + } + + public function setId(int $id): static + { + $this->id = $id; + + return $this; + } + + public function getUserName(): ?string + { + return $this->user_name; + } + + public function setUserName(?string $user_name): static + { + $this->user_name = $user_name; + + return $this; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(?string $name): static + { + $this->name = $name; + + return $this; + } + + public function getSurname(): ?string + { + return $this->surname; + } + + public function setSurname(?string $surname): static + { + $this->surname = $surname; + + return $this; + } + + public function getEmail(): ?string + { + return $this->email; + } + + public function setEmail(string $email): static + { + $this->email = $email; + + return $this; + } + + public function getPassword(): ?string + { + return $this->password; + } + + public function setPassword(string $password): static + { + $this->password = $password; + + return $this; + } + + public function isBlocked(): ?bool + { + return $this->is_blocked; + } + + public function setIsBlocked(?bool $is_blocked): static + { + $this->is_blocked = $is_blocked; + + return $this; + } + + public function getRole(): ?UserRole + { + return $this->role; + } + + public function setRole(UserRole $role): static + { + $this->role = $role; + + return $this; + } + + public function getCreatedAt(): ?\DateTimeImmutable + { + return $this->created_at; + } + + public function setCreatedAt(\DateTimeImmutable $created_at): static + { + $this->created_at = $created_at; + + return $this; + } +} diff --git a/web_app/src/Entity/WishList.php b/web_app/src/Entity/WishList.php new file mode 100644 index 0000000000000000000000000000000000000000..3ed0aa80ce31445afe0e85e25c3b62dfcfec2837 --- /dev/null +++ b/web_app/src/Entity/WishList.php @@ -0,0 +1,103 @@ +<?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] + private ?int $user_id = null; + + #[ORM\Column(length: 255)] + private ?string $name = null; + + #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)] + private ?\DateTimeInterface $expiration_date = null; + + #[ORM\Column] + private ?bool $is_active = null; + + #[ORM\Column] + private ?\DateTimeImmutable $created_at = null; + + public function getId(): ?int + { + return $this->id; + } + + public function setId(int $id): static + { + $this->id = $id; + + return $this; + } + + public function getUserId(): ?int + { + return $this->user_id; + } + + public function setUserId(int $user_id): static + { + $this->user_id = $user_id; + + return $this; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): static + { + $this->name = $name; + + return $this; + } + + public function getExpirationDate(): ?\DateTimeInterface + { + return $this->expiration_date; + } + + public function setExpirationDate(?\DateTimeInterface $expiration_date): static + { + $this->expiration_date = $expiration_date; + + return $this; + } + + public function isActive(): ?bool + { + return $this->is_active; + } + + public function setIsActive(bool $is_active): static + { + $this->is_active = $is_active; + + return $this; + } + + public function getCreatedAt(): ?\DateTimeImmutable + { + return $this->created_at; + } + + public function setCreatedAt(\DateTimeImmutable $created_at): static + { + $this->created_at = $created_at; + + return $this; + } +} diff --git a/web_app/src/Entity/WishListItem.php b/web_app/src/Entity/WishListItem.php new file mode 100644 index 0000000000000000000000000000000000000000..e83f9d9f545d4270ac9680f453b76234b1a9a662 --- /dev/null +++ b/web_app/src/Entity/WishListItem.php @@ -0,0 +1,50 @@ +<?php + +namespace App\Entity; + +use App\Repository\WishListItemRepository; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: WishListItemRepository::class)] +class WishListItem +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\Column] + private ?int $wishlist_id = null; + + #[ORM\Column] + private ?int $item_id = null; + + public function getId(): ?int + { + return $this->id; + } + + public function getWishlistId(): ?int + { + return $this->wishlist_id; + } + + public function setWishlistId(int $wishlist_id): static + { + $this->wishlist_id = $wishlist_id; + + return $this; + } + + public function getItemId(): ?int + { + return $this->item_id; + } + + public function setItemId(int $item_id): static + { + $this->item_id = $item_id; + + return $this; + } +} diff --git a/web_app/src/Entity/WishListMember.php b/web_app/src/Entity/WishListMember.php new file mode 100644 index 0000000000000000000000000000000000000000..ee4e53f34ec1e8b45430403b4cb8ef9dc0c5ae18 --- /dev/null +++ b/web_app/src/Entity/WishListMember.php @@ -0,0 +1,95 @@ +<?php + +namespace App\Entity; + +use App\Repository\WishListMemberRepository; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: WishListMemberRepository::class)] +class WishListMember +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\Column] + private ?int $wishlist_id = null; + + #[ORM\Column] + private ?int $user_id = null; + + #[ORM\Column] + private ?bool $can_edit = null; + + #[ORM\Column(nullable: true)] + private ?bool $is_accepted = null; + + #[ORM\Column] + private ?\DateTimeImmutable $created_at = null; + + public function getId(): ?int + { + return $this->id; + } + + public function getWishlistId(): ?int + { + return $this->wishlist_id; + } + + public function setWishlistId(int $wishlist_id): static + { + $this->wishlist_id = $wishlist_id; + + return $this; + } + + public function getUserId(): ?int + { + return $this->user_id; + } + + public function setUserId(int $user_id): static + { + $this->user_id = $user_id; + + return $this; + } + + public function isCanEdit(): ?bool + { + return $this->can_edit; + } + + public function setCanEdit(bool $can_edit): static + { + $this->can_edit = $can_edit; + + return $this; + } + + public function isAccepted(): ?bool + { + return $this->is_accepted; + } + + public function setIsAccepted(?bool $is_accepted): static + { + $this->is_accepted = $is_accepted; + + return $this; + } + + public function getCreatedAt(): ?\DateTimeImmutable + { + return $this->created_at; + } + + public function setCreatedAt(\DateTimeImmutable $created_at): static + { + $this->created_at = $created_at; + + return $this; + } +} diff --git a/web_app/src/Enum/UserRole.php b/web_app/src/Enum/UserRole.php new file mode 100644 index 0000000000000000000000000000000000000000..4b040563c164cbd5def4c6c336cd5118aacda1dc --- /dev/null +++ b/web_app/src/Enum/UserRole.php @@ -0,0 +1,19 @@ +<?php + +namespace App\Enum; + +enum UserRole: string +{ + case ADMIN = 'admin'; + case USER = 'user'; + + public function label(): string + { + return match($this) { + self::ADMIN => 'Administrator', + self::USER => 'Regular User' + }; + } +} + +?> \ No newline at end of file diff --git a/web_app/src/Repository/ItemRepository.php b/web_app/src/Repository/ItemRepository.php new file mode 100644 index 0000000000000000000000000000000000000000..229f40652e92f36659747e345c2569cb626b2aa2 --- /dev/null +++ b/web_app/src/Repository/ItemRepository.php @@ -0,0 +1,43 @@ +<?php + +namespace App\Repository; + +use App\Entity\Item; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<Item> + */ +class ItemRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Item::class); + } + + // /** + // * @return Item[] Returns an array of Item 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): ?Item + // { + // return $this->createQueryBuilder('i') + // ->andWhere('i.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +} diff --git a/web_app/src/Repository/ProductRepository.php b/web_app/src/Repository/PurchaseRepository.php similarity index 74% rename from web_app/src/Repository/ProductRepository.php rename to web_app/src/Repository/PurchaseRepository.php index 9564bc10fca9ed076a021b3c69054aee6bbe3ba7..6f189b3fc521a83374fbb6ac9a8c095988b3fb30 100644 --- a/web_app/src/Repository/ProductRepository.php +++ b/web_app/src/Repository/PurchaseRepository.php @@ -2,22 +2,22 @@ namespace App\Repository; -use App\Entity\Product; +use App\Entity\Purchase; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; /** - * @extends ServiceEntityRepository<Product> + * @extends ServiceEntityRepository<Purchase> */ -class ProductRepository extends ServiceEntityRepository +class PurchaseRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { - parent::__construct($registry, Product::class); + parent::__construct($registry, Purchase::class); } // /** - // * @return Product[] Returns an array of Product objects + // * @return Purchase[] Returns an array of Purchase objects // */ // public function findByExampleField($value): array // { @@ -31,7 +31,7 @@ class ProductRepository extends ServiceEntityRepository // ; // } - // public function findOneBySomeField($value): ?Product + // public function findOneBySomeField($value): ?Purchase // { // return $this->createQueryBuilder('p') // ->andWhere('p.exampleField = :val') diff --git a/web_app/src/Repository/UserRepository.php b/web_app/src/Repository/UserRepository.php new file mode 100644 index 0000000000000000000000000000000000000000..b29153bdebc8c935907c000813740c61a20275d8 --- /dev/null +++ b/web_app/src/Repository/UserRepository.php @@ -0,0 +1,43 @@ +<?php + +namespace App\Repository; + +use App\Entity\User; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<User> + */ +class UserRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, User::class); + } + + // /** + // * @return User[] Returns an array of User objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('u') + // ->andWhere('u.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('u.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } + + // public function findOneBySomeField($value): ?User + // { + // return $this->createQueryBuilder('u') + // ->andWhere('u.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +} diff --git a/web_app/src/Repository/WishListItemRepository.php b/web_app/src/Repository/WishListItemRepository.php new file mode 100644 index 0000000000000000000000000000000000000000..1b7d0fffc63dca82dcc81dba03a1829e18a13157 --- /dev/null +++ b/web_app/src/Repository/WishListItemRepository.php @@ -0,0 +1,43 @@ +<?php + +namespace App\Repository; + +use App\Entity\WishListItem; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<WishListItem> + */ +class WishListItemRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, WishListItem::class); + } + + // /** + // * @return WishListItem[] Returns an array of WishListItem 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): ?WishListItem + // { + // return $this->createQueryBuilder('w') + // ->andWhere('w.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +} diff --git a/web_app/src/Repository/WishListMemberRepository.php b/web_app/src/Repository/WishListMemberRepository.php new file mode 100644 index 0000000000000000000000000000000000000000..cd0e76f9c204ce1ba6f816daef0b621cf99fe5d2 --- /dev/null +++ b/web_app/src/Repository/WishListMemberRepository.php @@ -0,0 +1,43 @@ +<?php + +namespace App\Repository; + +use App\Entity\WishListMember; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<WishListMember> + */ +class WishListMemberRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, WishListMember::class); + } + + // /** + // * @return WishListMember[] Returns an array of WishListMember 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): ?WishListMember + // { + // return $this->createQueryBuilder('w') + // ->andWhere('w.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } +} diff --git a/web_app/src/Repository/WishListRepository.php b/web_app/src/Repository/WishListRepository.php new file mode 100644 index 0000000000000000000000000000000000000000..846c5434dc3c640090187cd19c0ffa15ceacf4dd --- /dev/null +++ b/web_app/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() + // ; + // } +}