diff --git a/src/Entity/Payment.php b/src/Entity/Payment.php index 0e788af..22d174f 100644 --- a/src/Entity/Payment.php +++ b/src/Entity/Payment.php @@ -2,6 +2,7 @@ namespace App\Entity; +use App\Enum\TicketData; use App\Repository\PaymentRepository; use Doctrine\ORM\Mapping as ORM; @@ -63,4 +64,11 @@ class Payment return $this; } + + public function getTotal(): float + { + return $this->customer->getTickets() + ->map(fn (Ticket $ticket) => TicketData::TICKET_DATA[$ticket->getType()]['price']) + ->reduce(fn (float $carry, float $price) => $carry + $price, 0); + } } diff --git a/templates/email/order.html.twig b/templates/email/order.html.twig index 6128df2..e6f905a 100644 --- a/templates/email/order.html.twig +++ b/templates/email/order.html.twig @@ -7,20 +7,22 @@
Hallo {{ payment.customer.firstname }}