diff --git a/conception/class_diagram.mermaid b/conception/class_diagram.mermaid index 820b6870e029a260620b52348990eab675abac3b..d708eab946b5f1e271e0b996d810989b7bd1c540 100644 --- a/conception/class_diagram.mermaid +++ b/conception/class_diagram.mermaid @@ -65,10 +65,10 @@ class User { -username: string -name: string - -username: string + -surname: string -email: string - -password_hash: string - -is_blocked: bool + -passwordHash: string + -isBlocked: bool -role:UserRole -created_at: datetime } @@ -77,37 +77,36 @@ -user: User -name: string -description: string - -items: Collection -expiration_date: datetime - -is_active: boolean - -url_view_mode: string - -url_edit_mode: string - -created_at: datetime + -isActive: boolean + -urlView_mode: string + -urlEdit_mode: string + -createdAt: datetime } class WishListMember { - -wishlist: WishList + -wishList: WishList -user: User - -can_edit: boolean - -is_accepted: boolean + -canEdit: boolean + -isAccepted: boolean } class Item { -title: string + -wishList: WishList -description: string -price: float - -purchase_url: string - -is_bought: boolean - -created_at: datetime + -purchaseUrl: string + -isBought: boolean + -createdAt: datetime } class Purchase { -user: User - -wishList: WishList - -item_id: int - -url_proof: string + -itemd: int + -urlProof: string -message: string - -created_at: datetime + -createdAt: datetime } %% ===== CONTROLLER LAYER ===== @@ -200,8 +199,8 @@ User "1" --> "*" WishList : creates User --> UserRole: uses %% It contains multiple Item objects, but an Item can exist independently of a WishList - WishList "1" o-- "*" Item : has - %% Either a user or a wishLIst are removed, then the record the wishListMember Object cannot exist + WishList "1" *-- "*" Item : belongs + %% Either a user or a wishLIst are removed, then the record the wishListMember Object can exist WishList "1" *-- "*" WishListMember : has User "*" *-- "*" WishListMember : can_access %% It does not make sense for a Purchase to exist without an associated Item. @@ -226,5 +225,4 @@ %% WishListView --> WishListController: uses %% ItemView --> ItemController: uses %% PurchaseView --> PurchaseController: uses - </div> diff --git a/server/web_app/migrations/Version20250228192241.php b/server/web_app/migrations/Version20250305103324.php similarity index 64% rename from server/web_app/migrations/Version20250228192241.php rename to server/web_app/migrations/Version20250305103324.php index 76fcf0ad3724fc763c9c3c452431b596cad71efb..39e2b669a63f71bcdde35e1df55f021109f7b952 100644 --- a/server/web_app/migrations/Version20250228192241.php +++ b/server/web_app/migrations/Version20250305103324.php @@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration; /** * Auto-generated Migration: Please modify to your needs! */ -final class Version20250228192241 extends AbstractMigration +final class Version20250305103324 extends AbstractMigration { public function getDescription(): string { @@ -20,18 +20,15 @@ final class Version20250228192241 extends AbstractMigration 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, is_bought 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'); - $this->addSql('CREATE TABLE purchase (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, wish_list_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)\', INDEX IDX_6117D13BA76ED395 (user_id), INDEX IDX_6117D13BD69F3311 (wish_list_id), INDEX IDX_6117D13B126F525E (item_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE item (id INT AUTO_INCREMENT NOT NULL, wish_list_id INT NOT NULL, title VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, price DOUBLE PRECISION NOT NULL, purchase_url VARCHAR(255) DEFAULT NULL, is_bought TINYINT(1) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_1F1B251ED69F3311 (wish_list_id), 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, 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)\', INDEX IDX_6117D13BA76ED395 (user_id), INDEX IDX_6117D13B126F525E (item_id), 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)\', UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), 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, description VARCHAR(255) NOT NULL, expiration_date DATETIME DEFAULT NULL, is_active TINYINT(1) NOT NULL, url_view_mode VARCHAR(255) NOT NULL, url_edit_mode VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_5B8739BDA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE wishlist_item (wish_list_id INT NOT NULL, item_id INT NOT NULL, INDEX IDX_6424F4E8D69F3311 (wish_list_id), INDEX IDX_6424F4E8126F525E (item_id), PRIMARY KEY(wish_list_id, item_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE wish_list_member (id INT AUTO_INCREMENT NOT NULL, wish_list_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)\', INDEX IDX_F4CA81DFD69F3311 (wish_list_id), INDEX IDX_F4CA81DFA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('ALTER TABLE item ADD CONSTRAINT FK_1F1B251ED69F3311 FOREIGN KEY (wish_list_id) REFERENCES wish_list (id)'); $this->addSql('ALTER TABLE purchase ADD CONSTRAINT FK_6117D13BA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); - $this->addSql('ALTER TABLE purchase ADD CONSTRAINT FK_6117D13BD69F3311 FOREIGN KEY (wish_list_id) REFERENCES wish_list (id)'); $this->addSql('ALTER TABLE purchase ADD CONSTRAINT FK_6117D13B126F525E FOREIGN KEY (item_id) REFERENCES item (id)'); $this->addSql('ALTER TABLE wish_list ADD CONSTRAINT FK_5B8739BDA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); - $this->addSql('ALTER TABLE wishlist_item ADD CONSTRAINT FK_6424F4E8D69F3311 FOREIGN KEY (wish_list_id) REFERENCES wish_list (id) ON DELETE CASCADE'); - $this->addSql('ALTER TABLE wishlist_item ADD CONSTRAINT FK_6424F4E8126F525E FOREIGN KEY (item_id) REFERENCES item (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE wish_list_member ADD CONSTRAINT FK_F4CA81DFD69F3311 FOREIGN KEY (wish_list_id) REFERENCES wish_list (id)'); $this->addSql('ALTER TABLE wish_list_member ADD CONSTRAINT FK_F4CA81DFA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); } @@ -39,19 +36,16 @@ final class Version20250228192241 extends AbstractMigration public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE item DROP FOREIGN KEY FK_1F1B251ED69F3311'); $this->addSql('ALTER TABLE purchase DROP FOREIGN KEY FK_6117D13BA76ED395'); - $this->addSql('ALTER TABLE purchase DROP FOREIGN KEY FK_6117D13BD69F3311'); $this->addSql('ALTER TABLE purchase DROP FOREIGN KEY FK_6117D13B126F525E'); $this->addSql('ALTER TABLE wish_list DROP FOREIGN KEY FK_5B8739BDA76ED395'); - $this->addSql('ALTER TABLE wishlist_item DROP FOREIGN KEY FK_6424F4E8D69F3311'); - $this->addSql('ALTER TABLE wishlist_item DROP FOREIGN KEY FK_6424F4E8126F525E'); $this->addSql('ALTER TABLE wish_list_member DROP FOREIGN KEY FK_F4CA81DFD69F3311'); $this->addSql('ALTER TABLE wish_list_member DROP FOREIGN KEY FK_F4CA81DFA76ED395'); $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 wishlist_item'); $this->addSql('DROP TABLE wish_list_member'); } } diff --git a/server/web_app/src/DataFixtures/ItemFixtures.php b/server/web_app/src/DataFixtures/ItemFixtures.php index a422b157f57adfbceef46e0d9a10c376a7f059f0..0afd18eb6e6fba424908201eedd1eec7fec0681b 100644 --- a/server/web_app/src/DataFixtures/ItemFixtures.php +++ b/server/web_app/src/DataFixtures/ItemFixtures.php @@ -3,15 +3,24 @@ namespace App\DataFixtures; use App\Entity\Item; +use App\Entity\WishList; use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Persistence\ObjectManager; +use Doctrine\Common\DataFixtures\DependentFixtureInterface; -class ItemFixtures extends Fixture +class ItemFixtures extends Fixture implements DependentFixtureInterface { public function load(ObjectManager $manager): void { + $wishLists = $manager->getRepository(WishList::class)->findAll(); + + if (empty($wishLists)) { + throw new \Exception('Ensure wishlists exists in the database before running this fixture.'); + } + $itemsData = [ - [ + [ + 'wishList' => $wishLists[0], 'title' => 'Smartphone', 'description' => 'Latest model with high-end specs', 'price' => 799.99, @@ -19,6 +28,7 @@ class ItemFixtures extends Fixture 'purchase_url' => 'https://example.com/smartphone', ], [ + 'wishList' => $wishLists[1], 'title' => 'Laptop', 'description' => 'Powerful laptop for work and gaming', 'price' => 1299.49, @@ -26,6 +36,7 @@ class ItemFixtures extends Fixture 'purchase_url' => 'https://example.com/laptop', ], [ + 'wishList' => $wishLists[2], 'title' => 'Wireless Headphones', 'description' => 'Noise-canceling headphones with long battery life', 'price' => 199.99, @@ -33,6 +44,7 @@ class ItemFixtures extends Fixture 'purchase_url' => 'https://example.com/headphones', ], [ + 'wishList' => $wishLists[0], 'title' => 'Coffee Maker', 'description' => 'Automatic coffee maker with multiple settings', 'price' => 89.99, @@ -40,6 +52,7 @@ class ItemFixtures extends Fixture 'purchase_url' => 'https://example.com/coffee-maker', ], [ + 'wishList' => $wishLists[1], 'title' => 'Gaming Chair', 'description' => 'Ergonomic chair for long gaming sessions', 'price' => 249.99, @@ -50,6 +63,7 @@ class ItemFixtures extends Fixture foreach ($itemsData as $itemData) { $item = new Item(); + $item->setWishList($itemData['wishList']); $item->setTitle($itemData['title']); $item->setDescription($itemData['description']); $item->setPrice($itemData['price']); @@ -62,4 +76,11 @@ class ItemFixtures extends Fixture $manager->flush(); } + + public function getDependencies(): array + { + return [ + WishListFixtures::class + ]; + } } diff --git a/server/web_app/src/DataFixtures/PurchaseFixtures.php b/server/web_app/src/DataFixtures/PurchaseFixtures.php index 045637e08c7bade15c3f907a9c272631d5774939..5a332e6fcbe049806f54143278ad64cb1e1e32df 100644 --- a/server/web_app/src/DataFixtures/PurchaseFixtures.php +++ b/server/web_app/src/DataFixtures/PurchaseFixtures.php @@ -16,24 +16,21 @@ class PurchaseFixtures extends Fixture implements DependentFixtureInterface { // Fetch existing users, wishlists, and items from the database $users = $manager->getRepository(User::class)->findAll(); - $wishLists = $manager->getRepository(WishList::class)->findAll(); $items = $manager->getRepository(Item::class)->findAll(); - if (empty($users) || empty($wishLists) || empty($items)) { - throw new \Exception('Ensure users, wishlists, and items exist in the database before running this fixture.'); + if (empty($users) || empty($items)) { + throw new \Exception('Ensure users and items exist in the database before running this fixture.'); } $purchasesData = [ [ 'user' => $users[0], - 'wishList' => $wishLists[0], 'item' => $items[0], 'url_proof' => 'https://example.com/proof1.jpg', 'message' => 'Hope you like this gift!', ], [ 'user' => $users[1], - 'wishList' => $wishLists[0], 'item' => $items[1], 'url_proof' => 'https://example.com/proof2.jpg', 'message' => 'A little surprise for you!', @@ -43,7 +40,6 @@ class PurchaseFixtures extends Fixture implements DependentFixtureInterface foreach ($purchasesData as $data) { $purchase = new Purchase(); $purchase->setUser($data['user']); - $purchase->setWishList($data['wishList']); $purchase->setItem($data['item']); $purchase->setUrlProof($data['url_proof']); $purchase->setMessage($data['message']); @@ -59,7 +55,6 @@ class PurchaseFixtures extends Fixture implements DependentFixtureInterface { return [ UserFixtures::class, - WishListFixtures::class, ItemFixtures::class, ]; } diff --git a/server/web_app/src/DataFixtures/WishListFixtures.php b/server/web_app/src/DataFixtures/WishListFixtures.php index eef728fbf2c374891768db143513c21d4fcf2988..6fa0ae3ed1a20b91e5f6ce09c0ab20a0b499786b 100644 --- a/server/web_app/src/DataFixtures/WishListFixtures.php +++ b/server/web_app/src/DataFixtures/WishListFixtures.php @@ -3,7 +3,6 @@ namespace App\DataFixtures; use App\Entity\User; -use App\Entity\Item; use App\Entity\WishList; use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Persistence\ObjectManager; @@ -15,11 +14,9 @@ class WishListFixtures extends Fixture implements DependentFixtureInterface { // Retrieve all users $users = $manager->getRepository(User::class)->findAll(); - // Retrieve all items - $items = $manager->getRepository(Item::class)->findAll(); - if (empty($users) || empty($items)) { - throw new \Exception('No users or items found. Please load UserFixtures and ItemFixtures first.'); + if (empty($users)) { + throw new \Exception('No users found. Please load UserFixtures first.'); } $wishListsData = [ @@ -27,7 +24,6 @@ class WishListFixtures extends Fixture implements DependentFixtureInterface 'name' => 'John\'s Birthday Wishlist', 'description' => 'Birthday Wishlist', 'user' => $users[0], // Assuming at least one user exists - 'items' => [$items[0], $items[1]], // Adding first two items 'expiration_date' => new \DateTime('+30 days'), 'is_active' => true, 'url_view_mode' => 'http:://url_view_mode.com', @@ -37,7 +33,6 @@ class WishListFixtures extends Fixture implements DependentFixtureInterface 'name' => 'Tech Gadgets Wishlist', 'description' => 'Gadgets Wishlist', 'user' => $users[1], // Use second user if available, else first user - 'items' => [$items[2], $items[3], $items[4]], // Adding three different items 'expiration_date' => new \DateTime('+60 days'), 'is_active' => true, 'url_view_mode' => 'http:://url_view_mode.com', @@ -47,7 +42,6 @@ class WishListFixtures extends Fixture implements DependentFixtureInterface 'name' => 'Home Essentials Wishlist', 'description' => 'Essentials Wishlist', 'user' => $users[2], // Use third user if available, else first user - 'items' => [$items[1], $items[4]], // Adding two different items 'expiration_date' => new \DateTime('+90 days'), 'is_active' => false, 'url_view_mode' => 'http:://url_view_mode.com', @@ -66,10 +60,6 @@ class WishListFixtures extends Fixture implements DependentFixtureInterface $wishList->setUrlEditMode($wishListData['url_edit_mode']); $wishList->setCreatedAt(new \DateTimeImmutable()); - foreach ($wishListData['items'] as $item) { - $wishList->getItems()->add($item); - } - $manager->persist($wishList); } @@ -79,8 +69,7 @@ class WishListFixtures extends Fixture implements DependentFixtureInterface public function getDependencies(): array { return [ - UserFixtures::class, - ItemFixtures::class, + UserFixtures::class ]; } } diff --git a/server/web_app/src/Entity/Item.php b/server/web_app/src/Entity/Item.php index 5d79fe802695ef5e729ca007b208e261688dc33c..e1e13f77a9f633a65c5a09574c5d7fbe2ec1cded 100644 --- a/server/web_app/src/Entity/Item.php +++ b/server/web_app/src/Entity/Item.php @@ -13,6 +13,10 @@ class Item #[ORM\Column] private ?int $id = null; + #[ORM\ManyToOne(targetEntity: WishList::class)] + #[ORM\JoinColumn(nullable: false)] + private ?WishList $wishList = null; + #[ORM\Column(length: 255)] private ?string $title = null; @@ -23,19 +27,30 @@ class Item private ?float $price = null; #[ORM\Column(length: 255, nullable: true)] - private ?string $purchase_url = null; + private ?string $purchaseUrl = null; #[ORM\Column(length: 255, nullable: true)] - private ?bool $is_bought = null; + private ?bool $isBought = null; #[ORM\Column] - private ?\DateTimeImmutable $created_at = null; + private ?\DateTimeImmutable $createdAt = null; public function getId(): ?int { return $this->id; } + public function getWishList(): ?WishList + { + return $this->wishList; + } + + public function setWishList(WishList $wishList): static + { + $this->wishList = $wishList; + return $this; + } + public function getTitle(): ?string { return $this->title; @@ -44,7 +59,6 @@ class Item public function setTitle(string $title): static { $this->title = $title; - return $this; } @@ -56,7 +70,6 @@ class Item public function setDescription(?string $description): static { $this->description = $description; - return $this; } @@ -68,43 +81,39 @@ class Item public function setPrice(float $price): static { $this->price = $price; - return $this; } public function getPurchaseUrl(): ?string { - return $this->purchase_url; + return $this->purchaseUrl; } - public function setPurchaseUrl(?string $purchase_url): static + public function setPurchaseUrl(?string $purchaseUrl): static { - $this->purchase_url = $purchase_url; - + $this->purchaseUrl = $purchaseUrl; return $this; } public function isBought(): ?bool { - return $this->is_bought; + return $this->isBought; } - public function setIsBought(?bool $is_bought): static + public function setIsBought(?bool $isBought): static { - $this->is_bought = $is_bought; - + $this->isBought = $isBought; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { - return $this->created_at; + return $this->createdAt; } - public function setCreatedAt(\DateTimeImmutable $created_at): static + public function setCreatedAt(\DateTimeImmutable $createdAt): static { - $this->created_at = $created_at; - + $this->createdAt = $createdAt; return $this; } } diff --git a/server/web_app/src/Entity/Purchase.php b/server/web_app/src/Entity/Purchase.php index d1c50be3bf05cefc722cb1c6a2a073633ff0ccad..7f5df9582b2592f45171ddc5bc1054587c0bd018 100644 --- a/server/web_app/src/Entity/Purchase.php +++ b/server/web_app/src/Entity/Purchase.php @@ -17,22 +17,18 @@ class Purchase #[ORM\JoinColumn(nullable: false)] private ?User $user = null; - #[ORM\ManyToOne(targetEntity: WishList::class)] - #[ORM\JoinColumn(nullable: false)] - private ?WishList $wishList = null; - #[ORM\ManyToOne(targetEntity: Item::class)] #[ORM\JoinColumn(nullable: false)] private ?Item $item = null; #[ORM\Column(length: 255, nullable: true)] - private ?string $url_proof = null; + private ?string $urlProof = null; #[ORM\Column(length: 255, nullable: true)] private ?string $message = null; #[ORM\Column] - private ?\DateTimeImmutable $created_at = null; + private ?\DateTimeImmutable $createdAt = null; public function getId(): ?int { @@ -47,19 +43,6 @@ class Purchase public function setUser(User $user): static { $this->user = $user; - - return $this; - } - - public function getWishList(): ?WishList - { - return $this->wishlist; - } - - public function setWishList(WishList $wishList): static - { - $this->wishList = $wishList; - return $this; } @@ -71,7 +54,6 @@ class Purchase public function setItem(Item $item): static { $this->item = $item; - return $this; } @@ -83,7 +65,6 @@ class Purchase public function setUrlProof(?string $url_proof): static { $this->url_proof = $url_proof; - return $this; } @@ -95,19 +76,17 @@ class Purchase public function setMessage(?string $message): static { $this->message = $message; - return $this; } public function getCreatedAt(): ?\DateTimeImmutable { - return $this->created_at; + return $this->createdAt; } - public function setCreatedAt(\DateTimeImmutable $created_at): static + public function setCreatedAt(\DateTimeImmutable $createdAt): static { - $this->created_at = $created_at; - + $this->createdAt = $createdAt; return $this; } } diff --git a/server/web_app/src/Entity/User.php b/server/web_app/src/Entity/User.php index b986c662e0168e100e2dadf512449741bc9a2a34..2e9ce2ffcbad1edd3238bd35b72564e15aaa9615 100644 --- a/server/web_app/src/Entity/User.php +++ b/server/web_app/src/Entity/User.php @@ -17,7 +17,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface private ?int $id = null; #[ORM\Column(length: 255, nullable: true)] - private ?string $user_name = null; + private ?string $userName = null; #[ORM\Column(length: 255, nullable: true)] private ?string $name = null; @@ -32,13 +32,13 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface private ?string $password = null; #[ORM\Column(nullable: true)] - private ?bool $is_blocked = null; + private ?bool $isBlocked = null; #[ORM\Column(enumType: UserRole::class)] private ?UserRole $role = null; #[ORM\Column] - private ?\DateTimeImmutable $created_at = null; + private ?\DateTimeImmutable $createdAt = null; public function getId(): ?int { @@ -47,13 +47,12 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface public function getUserName(): ?string { - return $this->user_name; + return $this->userName; } - public function setUserName(?string $user_name): static + public function setUserName(?string $userName): static { - $this->user_name = $user_name; - + $this->userName = $userName; return $this; } @@ -65,7 +64,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface public function setName(?string $name): static { $this->name = $name; - return $this; } @@ -77,7 +75,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface public function setSurname(?string $surname): static { $this->surname = $surname; - return $this; } @@ -89,7 +86,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface public function setEmail(string $email): static { $this->email = $email; - return $this; } @@ -101,19 +97,17 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface public function setPassword(string $password): static { $this->password = $password; - return $this; } public function isBlocked(): ?bool { - return $this->is_blocked; + return $this->isBlocked; } - public function setIsBlocked(?bool $is_blocked): static + public function setIsBlocked(?bool $isBlocked): static { - $this->is_blocked = $is_blocked; - + $this->isBlocked = $isBlocked; return $this; } @@ -125,19 +119,17 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface public function setRole(UserRole $role): static { $this->role = $role; - return $this; } public function getCreatedAt(): ?\DateTimeImmutable { - return $this->created_at; + return $this->createdAt; } - public function setCreatedAt(\DateTimeImmutable $created_at): static + public function setCreatedAt(\DateTimeImmutable $createdAt): static { - $this->created_at = $created_at; - + $this->createdAt = $createdAt; return $this; } diff --git a/server/web_app/src/Entity/WishList.php b/server/web_app/src/Entity/WishList.php index b4ced59166ffac4fdc30191b42247127628e8843..5bb2b14aa2cf32ab4ce64814fe84d2c0100a9213 100644 --- a/server/web_app/src/Entity/WishList.php +++ b/server/web_app/src/Entity/WishList.php @@ -26,15 +26,11 @@ class WishList #[ORM\Column(length: 255)] private ?string $description = null; - #[ORM\ManyToMany(targetEntity: Item::class)] - #[ORM\JoinTable(name: "wishlist_item")] - private Collection $items; - #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)] - private ?\DateTimeInterface $expiration_date = null; + private ?\DateTimeInterface $expirationDate = null; #[ORM\Column] - private ?bool $is_active = null; + private ?bool $isActive = null; //add getters and setters #[ORM\Column(length: 255)] @@ -44,7 +40,7 @@ class WishList private ?string $urlEditMode = null; #[ORM\Column] - private ?\DateTimeImmutable $created_at = null; + private ?\DateTimeImmutable $createdAt = null; public function __construct() { @@ -64,7 +60,6 @@ class WishList public function setUser(User $user): static { $this->user = $user; - return $this; } @@ -76,7 +71,6 @@ class WishList public function setName(string $name): static { $this->name = $name; - return $this; } @@ -88,31 +82,28 @@ class WishList public function setDescription(string $description): static { $this->description = $description; - return $this; } public function getExpirationDate(): ?\DateTimeInterface { - return $this->expiration_date; + return $this->expirationDate; } - public function setExpirationDate(?\DateTimeInterface $expiration_date): static + public function setExpirationDate(?\DateTimeInterface $expirationDate): static { - $this->expiration_date = $expiration_date; - + $this->expirationDate = $expirationDate; return $this; } public function isActive(): ?bool { - return $this->is_active; + return $this->isActive; } - public function setIsActive(bool $is_active): static + public function setIsActive(bool $isActive): static { - $this->is_active = $is_active; - + $this->isActive = $isActive; return $this; } @@ -122,6 +113,7 @@ class WishList public function setUrlViewMode (string $urlViewMode) { $this->urlViewMode = $urlViewMode; + return $this; } public function getUrlEditMode () { @@ -130,41 +122,17 @@ class WishList public function setUrlEditMode (string $urlEditMode) { $this->urlEditMode = $urlEditMode; - } - - public function getCreatedAt(): ?\DateTimeImmutable - { - return $this->created_at; - } - - public function setCreatedAt(\DateTimeImmutable $created_at): static - { - $this->created_at = $created_at; - return $this; } - /** - * @return Collection<int, Item> - */ - public function getItems(): Collection - { - return $this->items; - } - - public function addItem(Item $item): static + public function getCreatedAt(): ?\DateTimeImmutable { - if (!$this->items->contains($item)) { - $this->items->add($item); - } - - return $this; + return $this->createdAt; } - public function removeItem(Item $item): static + public function setCreatedAt(\DateTimeImmutable $createdAt): static { - $this->items->removeElement($item); - + $this->createdAt = $createdAt; return $this; } } diff --git a/server/web_app/src/Entity/WishListMember.php b/server/web_app/src/Entity/WishListMember.php index 5143481d7fd0aa9453e98027aaec09b4989c4331..cc617a249d35fb42dd26c442171be154860418cf 100644 --- a/server/web_app/src/Entity/WishListMember.php +++ b/server/web_app/src/Entity/WishListMember.php @@ -22,13 +22,13 @@ class WishListMember private ?User $user = null; #[ORM\Column] - private ?bool $can_edit = null; + private ?bool $canEdit = null; #[ORM\Column(nullable: true)] - private ?bool $is_accepted = null; + private ?bool $isAccepted = null; #[ORM\Column] - private ?\DateTimeImmutable $created_at = null; + private ?\DateTimeImmutable $createdAt = null; public function getId(): ?int { @@ -43,7 +43,6 @@ class WishListMember public function setWishList(WishList $wishList): static { $this->wishList = $wishList; - return $this; } @@ -55,19 +54,17 @@ class WishListMember public function setUser(User $user): static { $this->user = $user; - return $this; } public function isCanEdit(): ?bool { - return $this->can_edit; + return $this->canEdit; } - public function setCanEdit(bool $can_edit): static + public function setCanEdit(bool $canEdit): static { - $this->can_edit = $can_edit; - + $this->canEdit = $canEdit; return $this; } @@ -76,22 +73,20 @@ class WishListMember return $this->is_accepted; } - public function setIsAccepted(?bool $is_accepted): static + public function setIsAccepted(?bool $isAccepted): static { - $this->is_accepted = $is_accepted; - + $this->isAccepted = $isAccepted; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { - return $this->created_at; + return $this->createdAt; } - public function setCreatedAt(\DateTimeImmutable $created_at): static + public function setCreatedAt(\DateTimeImmutable $createdAt): static { - $this->created_at = $created_at; - + $this->createdAt = $createdAt; return $this; } }