Skip to content
Snippets Groups Projects
Commit 00b332b8 authored by user's avatar user
Browse files

correction owner wishlist

parent 0e952eb8
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,8 @@ class HomeController extends AbstractController
'Login' => $this->generateUrl('login'),
'My Wishlists' => $this->generateUrl('app_wishlist_index'),
'Admin Dashboard' => $this->generateUrl('admin_dashboard'),
'Profile' => $this->generateUrl('user_profile'),
],
]);
}
......
......@@ -21,7 +21,7 @@ final class WishlistController extends AbstractController
return $this->render('wishlist/index.html.twig', [
'wishlists' => $user->getWishlists()->toArray()
'wishlists' => $user->getWishlists()
]);
}
......@@ -40,7 +40,7 @@ final class WishlistController extends AbstractController
}
return $this->render('wishlist/new.html.twig', [
'wishlist' => $wishlist,
'wishlists' => $wishlist,
'form' => $form,
]);
......
......@@ -164,7 +164,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $this->wishlists;
}
public function addToAuthorWhishlists(Wishlists $wishlist){
public function addToAuthorWhishlists(Wishlist $wishlist){
if (!$this->wishlists->contains($wishlist)) {
$this->wishlists[] = $wishlist;
}
......
......@@ -32,6 +32,21 @@ class Wishlist
#[ORM\OneToMany(targetEntity: Item::class, mappedBy: 'wishlist', orphanRemoval: true)]
private Collection $items;
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'wishlists')]
#[ORM\JoinColumn(nullable: false)]
private ?User $owner = null;
public function getOwner(): ?User
{
return $this->owner;
}
public function setOwner(?User $owner): static
{
$this->owner = $owner;
return $this;
}
public function __construct()
{
$this->items = new ArrayCollection();
......
......@@ -31,6 +31,6 @@
<button title="Delete wishlist">🗑</button>
</div>
</div>
{% end for %}
{% endfor %}
</div>
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment