@@ -18,7 +18,7 @@ class FacilityDto
|
||||
public \DateTimeImmutable $createdAt;
|
||||
public array $validationErrors;
|
||||
|
||||
public function createFacilityArray(): array
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id ?? '',
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ class GameDto
|
||||
'gameDateTime' => !empty($this->gameDateTime) ? $this->gameDateTime->format('Y-m-d H:i:s') : null,
|
||||
'season' => $this->seasonDto->createSeasonArray() ?? [],
|
||||
'notes' => $this->notes ?? null,
|
||||
'facility' => $this->facilityDto->createFacilityArray() ?? [],
|
||||
'facility' => $this->facilityDto->toArray() ?? [],
|
||||
'pointsHome' => $this->pointsHome ?? 0,
|
||||
'pointsAway' => $this->pointsAway ?? 0,
|
||||
'createdAt' => !empty($this->createdAt) ? $this->createdAt->format('Y-m-d H:i:s') : null,
|
||||
|
||||
@@ -16,7 +16,7 @@ class FacilityFactory
|
||||
}
|
||||
if (!empty($facilityDto->address))
|
||||
{
|
||||
$facilityEntity->setName($facilityDto->address);
|
||||
$facilityEntity->setAddress($facilityDto->address);
|
||||
}
|
||||
if (!empty($facilityDto->availableHourList))
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ class HandleCreateFacilities
|
||||
{
|
||||
throw new HttpException(Response::HTTP_NOT_FOUND, 'Season not found, check id.');
|
||||
}
|
||||
$facilityDtoList = [];
|
||||
$facilityEntityList = [];
|
||||
foreach ($request->toArray() as $facilityItem)
|
||||
{
|
||||
$facilityDto = new FacilityDto();
|
||||
@@ -53,13 +53,20 @@ class HandleCreateFacilities
|
||||
$facilityEntity = $this->facilityFactory::create($facilityDto);
|
||||
$facilityEntity->setSeason($seasonEntity);
|
||||
$this->entityManager->persist($facilityEntity);
|
||||
$facilityDtoList[] = $facilityDto->createFacilityArray();
|
||||
$facilityEntityList[] = $facilityEntity;
|
||||
}
|
||||
$this->entityManager->flush();
|
||||
$facilityResponseArray = [];
|
||||
foreach ($facilityEntityList as $facilityEntity)
|
||||
{
|
||||
$facilityDto = new FacilityDto();
|
||||
$facilityDto->fillFromObject($facilityEntity);
|
||||
$facilityResponseArray[] = $facilityDto->toArray();
|
||||
}
|
||||
return new JsonResponse(
|
||||
data: [
|
||||
'success' => true,
|
||||
'facilities' => $facilityDtoList
|
||||
'facilities' => $facilityResponseArray
|
||||
],
|
||||
status: Response::HTTP_OK
|
||||
);
|
||||
|
||||
@@ -41,7 +41,7 @@ class HandleGetAllFacilities
|
||||
{
|
||||
$facilityDto = new FacilityDto();
|
||||
$facilityDto->fillFromObject($facilityObj);
|
||||
$facilityArray[] = $facilityDto->createFacilityArray();
|
||||
$facilityArray[] = $facilityDto->toArray();
|
||||
}
|
||||
}
|
||||
return new JsonResponse(
|
||||
|
||||
@@ -33,7 +33,7 @@ class AuthenticationSuccessListener
|
||||
}
|
||||
$userDto->receivedNotificationDtoList = $notificationDtoList;
|
||||
$userDto->fillFromObject($user);
|
||||
$expirationDateTime = (new \DateTime('now', new \DateTimeZone('Europe/Madrid')))->modify('+1800 seconds');
|
||||
$expirationDateTime = (new \DateTime('now', new \DateTimeZone('Europe/Madrid')))->modify('+18000 seconds');
|
||||
$data['expirationDateTime'] = $expirationDateTime->format('Y-m-d H:i:s');
|
||||
$data['user'] = $userDto->toLoginArray();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user