fix: invalidate booking data caches after updating personal data
This commit is contained in:
@@ -9,6 +9,7 @@ use App\BusProNet\Model\PersonalData;
|
||||
use App\Entity\User;
|
||||
use App\Form\PersonalDataType;
|
||||
use App\Security\Crypt;
|
||||
use App\Service\BookingEditDataLoaderService;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -26,13 +27,15 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
class PersonalDataController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @param ApiClient $apiClient BusProNet API client for data operations
|
||||
* @param Crypt $crypt Encryption service for password handling
|
||||
* @param LoggerInterface $logger Logger for audit trails and debugging
|
||||
* @param ApiClient $apiClient BusProNet API client for data operations
|
||||
* @param Crypt $crypt Encryption service for password handling
|
||||
* @param BookingEditDataLoaderService $dataLoader Data loader for cache invalidation
|
||||
* @param LoggerInterface $logger Logger for audit trails and debugging
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly ApiClient $apiClient,
|
||||
private readonly Crypt $crypt,
|
||||
private readonly BookingEditDataLoaderService $dataLoader,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
@@ -87,6 +90,10 @@ class PersonalDataController extends AbstractController
|
||||
if ($personalDataForm->isSubmitted() && $personalDataForm->isValid()) {
|
||||
try {
|
||||
$this->apiClient->updatePersonalData($email, $password, $personalData);
|
||||
|
||||
// Invalidate cached bookings to ensure edit mode shows updated applicant data
|
||||
$this->dataLoader->invalidateUserBookingCaches($user);
|
||||
|
||||
$this->addFlash('success', 'Deine persönlichen Daten wurden aktualisiert');
|
||||
$this->logger->info('Updated personal data', [
|
||||
'email' => $user->getEmail(),
|
||||
|
||||
Reference in New Issue
Block a user