Skip to content

Commit

Permalink
fixed code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Ruf committed Feb 1, 2024
1 parent 58a1d02 commit f634c59
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/Mealz/MealBundle/Controller/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace App\Mealz\MealBundle\Controller;

use App\Mealz\MealBundle\Entity\Event;
use App\Mealz\MealBundle\Entity\Participant;
use App\Mealz\MealBundle\Event\EventParticipationUpdateEvent;
use App\Mealz\MealBundle\Repository\DayRepositoryInterface;
use App\Mealz\MealBundle\Repository\EventRepositoryInterface;
Expand Down
8 changes: 4 additions & 4 deletions src/Mealz/MealBundle/Controller/MealGuestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@

class MealGuestController extends BaseController
{
private EventParticipationService $eventParticipationService;
private EventParticipationService $eventPartSrv;
private GuestParticipationService $gps;
private EventDispatcherInterface $eventDispatcher;

public function __construct(
EventParticipationService $eventParticipationService,
EventParticipationService $eventPartSrv,
GuestParticipationService $gps,
EventDispatcherInterface $eventDispatcher
) {
$this->eventParticipationService = $eventParticipationService;
$this->eventPartSrv = $eventPartSrv;
$this->gps = $gps;
$this->eventDispatcher = $eventDispatcher;
}
Expand Down Expand Up @@ -125,7 +125,7 @@ public function joinEventAsGuest(
}

try {
$eventParticipation = $this->eventParticipationService->joinAsGuest(
$eventParticipation = $this->eventPartSrv->joinAsGuest(
$parameters['firstName'],
$parameters['lastName'],
$parameters['company'],
Expand Down
12 changes: 6 additions & 6 deletions src/Mealz/MealBundle/Service/EventParticipationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
use App\Mealz\MealBundle\Entity\Participant;
use App\Mealz\MealBundle\Repository\EventParticipationRepositoryInterface;
use App\Mealz\MealBundle\Repository\EventRepositoryInterface;
use App\Mealz\MealBundle\Service\GuestParticipationService;
use App\Mealz\UserBundle\Entity\Profile;
use DateTime;
use Doctrine\ORM\EntityManagerInterface;
use Exception;

Expand All @@ -20,20 +18,20 @@ class EventParticipationService
private EntityManagerInterface $em;
private EventParticipationRepositoryInterface $eventPartRepo;
private EventRepositoryInterface $eventRepo;
private GuestParticipationService $guestParticipationService;
private GuestParticipationService $guestPartSrv;

public function __construct(
Doorman $doorman,
EntityManagerInterface $em,
EventRepositoryInterface $eventRepo,
EventParticipationRepositoryInterface $eventPartRepo,
GuestParticipationService $guestParticipationService
GuestParticipationService $guestPartSrv
) {
$this->doorman = $doorman;
$this->em = $em;
$this->eventPartRepo = $eventPartRepo;
$this->eventRepo = $eventRepo;
$this->guestParticipationService = $guestParticipationService;
$this->guestPartSrv = $guestPartSrv;
}

/**
Expand Down Expand Up @@ -94,7 +92,7 @@ public function joinAsGuest(
string $company,
Day $eventDay
): ?EventParticipation {
$guestProfile = $this->guestParticipationService->getCreateGuestProfile(
$guestProfile = $this->guestPartSrv->getCreateGuestProfile(
$firstName,
$lastName,
$company,
Expand All @@ -112,6 +110,7 @@ public function joinAsGuest(

$this->em->flush();
$this->em->commit();

return $eventParticiation;
} catch (Exception $e) {
$this->em->rollback();
Expand Down Expand Up @@ -174,6 +173,7 @@ private function getParticipantName(Participant $participant): string
$company = strlen($participant->getProfile()->getCompany()) > 0 ?
' (' . $participant->getProfile()->getCompany() . ')' :
' (Gast)';

return $participant->getProfile()->getFullName() . $company;
} else {
return $participant->getProfile()->getFullName();
Expand Down
4 changes: 4 additions & 0 deletions src/Resources/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@
"created": "The timeslot was successfully created.",
"deleted": "The timeslot was succefully deleted.",
"updated": "The timeslot was successfully updated."
},
"guest": {
"joined": "You are participating in the Event. We are looking forward to meeting you."
}
}
},
Expand Down Expand Up @@ -232,6 +235,7 @@
"description": "As our guest, we would like to invite you to lunch in the AOE Eatery. To order a meal, register no later than one day before your visit to AOE with your personal information and choose the desired dish. Your order will be forwarded to our cooks.\n\nWe hope that you enjoy your lunch\nAOE",
"event": {
"submit": "Participate",
"joined": "You're participating at \"%EventTitle%\" on the %eventDate%.",
"title": "Event at AOE",
"description": "We would like to invite you to join us at the Event \"%EventTitle%\". To ensure we can plan ahead with you, please register for the event by %lockDate% at the latest.\n\nWe look forward to having you!"
}
Expand Down

0 comments on commit f634c59

Please sign in to comment.