Updated DateTime types.
This commit is contained in:
@@ -21,13 +21,13 @@ class Booking
|
|||||||
#[ORM\Column(length: 20)]
|
#[ORM\Column(length: 20)]
|
||||||
private ?string $refNumber = null;
|
private ?string $refNumber = null;
|
||||||
|
|
||||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
|
||||||
private ?\DateTimeInterface $arrivalDate = null;
|
private ?\DateTimeInterface $arrivalDate = null;
|
||||||
|
|
||||||
#[ORM\Column(type : Types::DATE_MUTABLE)]
|
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
|
||||||
private ?\DateTimeInterface $departureDate = null;
|
private ?\DateTimeInterface $departureDate = null;
|
||||||
|
|
||||||
#[ORM\Column(type : Types::DATETIMETZ_MUTABLE)]
|
#[ORM\Column(type: Types::DATETIMETZ_IMMUTABLE)]
|
||||||
private ?\DateTimeInterface $bookingTime = null;
|
private ?\DateTimeInterface $bookingTime = null;
|
||||||
|
|
||||||
#[ORM\OneToOne(mappedBy: 'booking', cascade: ['persist', 'remove'])]
|
#[ORM\OneToOne(mappedBy: 'booking', cascade: ['persist', 'remove'])]
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ class FareTable
|
|||||||
#[ORM\JoinColumn(nullable: false, onDelete: "CASCADE")]
|
#[ORM\JoinColumn(nullable: false, onDelete: "CASCADE")]
|
||||||
private ?RoomCategory $roomCategory = null;
|
private ?RoomCategory $roomCategory = null;
|
||||||
|
|
||||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: false)]
|
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: false)]
|
||||||
private ?\DateTimeInterface $startDate = null;
|
private ?\DateTimeInterface $startDate = null;
|
||||||
|
|
||||||
#[ORM\Column(type : Types::DATETIME_MUTABLE, nullable: true)]
|
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)]
|
||||||
private ?\DateTimeInterface $endDate = null;
|
private ?\DateTimeInterface $endDate = null;
|
||||||
|
|
||||||
#[ORM\Column(length : 255, nullable: true)]
|
#[ORM\Column(length : 255, nullable: true)]
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
use App\Repository\RoomAvailabilityRepository;
|
use App\Repository\RoomAvailabilityRepository;
|
||||||
use Doctrine\DBAL\Types\Types;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: RoomAvailabilityRepository::class)]
|
#[ORM\Entity(repositoryClass: RoomAvailabilityRepository::class)]
|
||||||
@@ -22,9 +21,9 @@ class RoomAvailability
|
|||||||
#[ORM\Column(nullable: false)]
|
#[ORM\Column(nullable: false)]
|
||||||
private ?int $numAvailable = null;
|
private ?int $numAvailable = null;
|
||||||
|
|
||||||
public function getDay(): ?\DateTimeInterface
|
public function getDay(): ?\DateTimeImmutable
|
||||||
{
|
{
|
||||||
return new \DateTime($this->day);
|
return new \DateTimeImmutable($this->day);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setDay(\DateTimeInterface $day): static
|
public function setDay(\DateTimeInterface $day): static
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ class RoomPrice
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDate(): ?\DateTime
|
public function getDate(): ?\DateTimeImmutable
|
||||||
{
|
{
|
||||||
return new \DateTime($this->date);
|
return new \DateTimeImmutable($this->date);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDateString(): ?string
|
public function getDateString(): ?string
|
||||||
@@ -48,7 +48,7 @@ class RoomPrice
|
|||||||
return $this->date;
|
return $this->date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setDate(\DateTime $date): static
|
public function setDate(\DateTimeInterface $date): static
|
||||||
{
|
{
|
||||||
$this->date = $date->format('Y-m-d');
|
$this->date = $date->format('Y-m-d');
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
namespace App\Request;
|
namespace App\Request;
|
||||||
|
|
||||||
use App\Entity\BookingCustomer;
|
use App\Entity\BookingCustomer;
|
||||||
use DateTimeInterface;
|
use DateTimeImmutable;
|
||||||
use OpenApi\Attributes as OA;
|
use OpenApi\Attributes as OA;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
@@ -12,11 +12,11 @@ class BookingCreateRequest
|
|||||||
#[OA\Property(description: 'Booking Arrival date')]
|
#[OA\Property(description: 'Booking Arrival date')]
|
||||||
#[Assert\NotBlank]
|
#[Assert\NotBlank]
|
||||||
#[Assert\GreaterThanOrEqual(value: 'today')]
|
#[Assert\GreaterThanOrEqual(value: 'today')]
|
||||||
public DateTimeInterface $arrivalDate;
|
public DateTimeImmutable $arrivalDate;
|
||||||
|
|
||||||
#[OA\Property(description: 'Booking departure date')]
|
#[OA\Property(description: 'Booking departure date')]
|
||||||
#[Assert\NotBlank]
|
#[Assert\NotBlank]
|
||||||
public DateTimeInterface $departureDate;
|
public DateTimeImmutable $departureDate;
|
||||||
|
|
||||||
#[OA\Property(
|
#[OA\Property(
|
||||||
description: 'Booking customer details',
|
description: 'Booking customer details',
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Request;
|
namespace App\Request;
|
||||||
|
|
||||||
use DateTimeInterface;
|
use DateTimeImmutable;
|
||||||
use OpenApi\Attributes as OA;
|
use OpenApi\Attributes as OA;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
@@ -10,9 +10,9 @@ class SearchPeriodRequest
|
|||||||
{
|
{
|
||||||
#[OA\Property(description: 'Period start date')]
|
#[OA\Property(description: 'Period start date')]
|
||||||
#[Assert\NotBlank]
|
#[Assert\NotBlank]
|
||||||
public DateTimeInterface $startDate;
|
public DateTimeImmutable $startDate;
|
||||||
|
|
||||||
#[OA\Property(description: 'Period end date')]
|
#[OA\Property(description: 'Period end date')]
|
||||||
#[Assert\NotBlank]
|
#[Assert\NotBlank]
|
||||||
public DateTimeInterface $endDate;
|
public DateTimeImmutable $endDate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Request;
|
namespace App\Request;
|
||||||
|
|
||||||
use DateTimeInterface;
|
use DateTimeImmutable;
|
||||||
use OpenApi\Attributes as OA;
|
use OpenApi\Attributes as OA;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
@@ -14,9 +14,9 @@ class SearchPricesForCategoryRequest
|
|||||||
|
|
||||||
#[OA\Property(description: 'Period start date')]
|
#[OA\Property(description: 'Period start date')]
|
||||||
#[Assert\NotBlank]
|
#[Assert\NotBlank]
|
||||||
public DateTimeInterface $startDate;
|
public DateTimeImmutable $startDate;
|
||||||
|
|
||||||
#[OA\Property(description: 'Period end date')]
|
#[OA\Property(description: 'Period end date')]
|
||||||
#[Assert\NotBlank]
|
#[Assert\NotBlank]
|
||||||
public DateTimeInterface $endDate;
|
public DateTimeImmutable $endDate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,36 +2,25 @@
|
|||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
use App\DTO\AppSetupConfig;
|
|
||||||
use App\DTO\ExampleDataConfig;
|
use App\DTO\ExampleDataConfig;
|
||||||
use App\Entity\BedType;
|
use App\Entity\BedType;
|
||||||
use App\Entity\ConfigVariable;
|
|
||||||
use App\Entity\FareTable;
|
use App\Entity\FareTable;
|
||||||
use App\Entity\RoomCategory;
|
use App\Entity\RoomCategory;
|
||||||
use App\Entity\RoomCategoryBedType;
|
use App\Entity\RoomCategoryBedType;
|
||||||
use App\Entity\RoomFare;
|
use App\Entity\RoomFare;
|
||||||
use App\Entity\User;
|
|
||||||
use App\Enum\UserRoleEnum;
|
|
||||||
use App\Repository\ConfigVariableRepository;
|
|
||||||
use App\Repository\FareTableRepository;
|
use App\Repository\FareTableRepository;
|
||||||
use App\Repository\RoomAvailabilityRepository;
|
use App\Repository\RoomAvailabilityRepository;
|
||||||
use App\Repository\RoomCategoryRepository;
|
use App\Repository\RoomCategoryRepository;
|
||||||
use App\Repository\RoomFareRepository;
|
use App\Repository\RoomFareRepository;
|
||||||
use App\Serializer\Normalizer\EntityByIdDenormalizer;
|
use DateTimeImmutable;
|
||||||
use DateTime;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use stdClass;
|
|
||||||
use Symfony\Component\Config\FileLocator;
|
use Symfony\Component\Config\FileLocator;
|
||||||
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
|
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
|
||||||
use Symfony\Component\Serializer\Encoder\JsonEncoder;
|
use Symfony\Component\Serializer\Encoder\JsonEncoder;
|
||||||
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
|
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
|
||||||
use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
|
|
||||||
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
||||||
use Symfony\Component\Serializer\Serializer;
|
use Symfony\Component\Serializer\Serializer;
|
||||||
use Symfony\Component\Serializer\SerializerInterface;
|
|
||||||
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
|
|
||||||
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service for setup proccess.
|
* Service for setup proccess.
|
||||||
@@ -163,7 +152,7 @@ class ExampleDataService
|
|||||||
|
|
||||||
private function GenerateFares(ExampleDataConfig $config): bool
|
private function GenerateFares(ExampleDataConfig $config): bool
|
||||||
{
|
{
|
||||||
$generationTime = new DateTime();
|
$generationTime = new DateTimeImmutable();
|
||||||
$strGenTime = $generationTime->format('d-m-Y H:i:s');
|
$strGenTime = $generationTime->format('d-m-Y H:i:s');
|
||||||
|
|
||||||
$roomCategoryList = $this->roomCategoryRepository->findAll();
|
$roomCategoryList = $this->roomCategoryRepository->findAll();
|
||||||
|
|||||||
Reference in New Issue
Block a user