force use of RouterInterface

This commit is contained in:
Jannis Portmann 2021-06-01 14:05:04 +02:00
parent c20afb737a
commit 15666fc92d

View file

@ -15,15 +15,17 @@ use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email; use Symfony\Component\Mime\Email;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RouterInterface;
class TradeController extends AbstractController class TradeController extends AbstractController
{ {
#[Route('/trade/{id}', name: 'trade')] #[Route('/trade/{id}', name: 'trade')]
public function sendEmail(MailerInterface $mailer, Offering $offer, OfferingRepository $offeringRepository, WishRepository $wishRepository): Response public function sendEmail(MailerInterface $mailer, Offering $offer, OfferingRepository $offeringRepository, WishRepository $wishRepository, RouterInterface $router): Response
{ {
$user = $this->getUser(); $user = $this->getUser();
$mail_url = $this->generateUrl('user_public', [ $this->router = $router;
$mail_url = $this->router->generate('user_public', [
'id' => $offer->getByUser()->getId(), 'id' => $offer->getByUser()->getId(),
], UrlGeneratorInterface::ABSOLUTE_URL); ], UrlGeneratorInterface::ABSOLUTE_URL);