Refactoring

This commit is contained in:
Jannis Portmann 2021-06-06 11:20:51 +02:00
parent 8c120bd872
commit d550d01464

View file

@ -14,20 +14,14 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RouterInterface;
class TradeController extends AbstractController
{
#[Route('/trade/{id}', name: 'trade')]
public function sendEmail(MailerInterface $mailer, Offering $offer, OfferingRepository $offeringRepository, WishRepository $wishRepository, RouterInterface $router): Response
public function sendEmail(MailerInterface $mailer, Offering $offer, OfferingRepository $offeringRepository, WishRepository $wishRepository): Response
{
$user = $this->getUser();
$this->router = $router;
$mail_url = $this->router->generate('user_public', [
'id' => $offer->getByUser()->getId(),
], UrlGeneratorInterface::ABSOLUTE_URL);
if($user != $offer->getByUser())
{
@ -40,8 +34,7 @@ class TradeController extends AbstractController
->htmlTemplate('user/trade/offer_email.html.twig')
->context([
'user' => $user,
'id' => $offer->getByUser()->getId(),
'userOffersLink' => $mail_url,
'id' => $user->getId(),
])
;
try