feat: custom destinations
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
use App\Entity\Destination;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
class DestinationDto
|
||||
{
|
||||
#[Assert\NotBlank(message: 'Bitte angeben')]
|
||||
private ?string $product = null;
|
||||
|
||||
#[Assert\NotNull(message: 'Bitte das Beginndatum angeben')]
|
||||
private ?\DateTimeImmutable $dateFrom = null;
|
||||
|
||||
#[Assert\NotNull(message: 'Bitte das Enddatum angeben')]
|
||||
private ?\DateTimeImmutable $dateTo = null;
|
||||
|
||||
#[Assert\NotBlank(message: 'Bitte angeben')]
|
||||
private ?string $hotelBusProId = null;
|
||||
|
||||
private array $pickups = [];
|
||||
|
||||
public static function fromEntity(Destination $destination): static
|
||||
{
|
||||
$instance = new static();
|
||||
|
||||
$pickupIds = array_map(function (array $pickup) {
|
||||
return $pickup['busProId'];
|
||||
}, $destination->getPickups());
|
||||
|
||||
$instance
|
||||
->setProduct($destination->getProduct())
|
||||
->setDateFrom($destination->getDateFrom())
|
||||
->setDateTo($destination->getDateTo())
|
||||
->setHotelBusProId($destination->getHotelBusProId())
|
||||
->setPickups($pickupIds)
|
||||
;
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public function getProduct(): ?string
|
||||
{
|
||||
return $this->product;
|
||||
}
|
||||
|
||||
public function setProduct(?string $product): static
|
||||
{
|
||||
$this->product = $product;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateFrom(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->dateFrom;
|
||||
}
|
||||
|
||||
public function setDateFrom(?\DateTimeImmutable $dateFrom): static
|
||||
{
|
||||
$this->dateFrom = $dateFrom;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateTo(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->dateTo;
|
||||
}
|
||||
|
||||
public function setDateTo(?\DateTimeImmutable $dateTo): static
|
||||
{
|
||||
$this->dateTo = $dateTo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getHotelBusProId(): ?string
|
||||
{
|
||||
return $this->hotelBusProId;
|
||||
}
|
||||
|
||||
public function setHotelBusProId(?string $hotelBusProId): static
|
||||
{
|
||||
$this->hotelBusProId = $hotelBusProId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPickups(): array
|
||||
{
|
||||
return $this->pickups;
|
||||
}
|
||||
|
||||
public function setPickups(array $pickups): static
|
||||
{
|
||||
$this->pickups = $pickups;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,11 @@ namespace App\Model;
|
||||
|
||||
class EmailAttachmentDto
|
||||
{
|
||||
public function __construct(private string $name, private string $content, private string $mimeType)
|
||||
{
|
||||
public function __construct(
|
||||
private readonly string $name,
|
||||
private readonly string $content,
|
||||
private readonly string $mimeType
|
||||
) {
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
|
||||
+5
-16
@@ -4,24 +4,13 @@ namespace App\Model;
|
||||
|
||||
class UploadDto
|
||||
{
|
||||
private string $uuid;
|
||||
private string $filename;
|
||||
private string $originalFilename;
|
||||
private string $mimeType;
|
||||
private int $size;
|
||||
|
||||
public function __construct(
|
||||
string $uuid,
|
||||
string $filename,
|
||||
string $originalFilename,
|
||||
string $mimeType,
|
||||
int $size
|
||||
private readonly string $uuid,
|
||||
private readonly string $filename,
|
||||
private readonly string $originalFilename,
|
||||
private readonly string $mimeType,
|
||||
private readonly int $size
|
||||
) {
|
||||
$this->uuid = $uuid;
|
||||
$this->filename = $filename;
|
||||
$this->originalFilename = $originalFilename;
|
||||
$this->mimeType = $mimeType;
|
||||
$this->size = $size;
|
||||
}
|
||||
|
||||
public function getUuid(): string
|
||||
|
||||
Reference in New Issue
Block a user