show offers on user page
This commit is contained in:
parent
b5d7281d77
commit
b3500b630a
3 changed files with 36 additions and 9 deletions
|
@ -6,6 +6,7 @@ use App\Entity\Wish;
|
|||
use App\Entity\User;
|
||||
use App\Form\WishFormType;
|
||||
|
||||
use App\Repository\OfferingRepository;
|
||||
use App\Repository\WishRepository;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
@ -25,10 +26,13 @@ class UserController extends AbstractController
|
|||
}
|
||||
|
||||
#[Route('/user', name: 'user_page')]
|
||||
public function user(): Response
|
||||
public function user(OfferingRepository $offeringRepository): Response
|
||||
{
|
||||
$user = $this->getUser();
|
||||
|
||||
return $this->render('user/index.html.twig', [
|
||||
'user' => $this->getUser(),
|
||||
'user' => $user,
|
||||
'offers' => $offeringRepository->findByUser($user),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -71,7 +75,7 @@ class UserController extends AbstractController
|
|||
public function deleteWish(Wish $wish): Response
|
||||
{
|
||||
$user = $this->getUser();
|
||||
|
||||
|
||||
$user->removeWish($wish);
|
||||
$this->entityManager->persist($wish);
|
||||
$this->entityManager->flush();
|
||||
|
|
Reference in a new issue