feat: custom destinations
This commit is contained in:
1 parent
57e1082f2f
commit
efc4b58077
27 files changed
+826
-40
No files matched your search
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\System\Destination;
|
||||
|
||||
use App\Entity\Destination;
|
||||
use App\Model\DestinationDto;
|
||||
|
||||
trait DestinationTrait
|
||||
{
|
||||
private function mapPickups(DestinationDto $destinationDto): array
|
||||
{
|
||||
$pickups = [];
|
||||
|
||||
foreach ($destinationDto->getPickups() as $pickupId) {
|
||||
$pickup = $this->pickupDataProvider->get($pickupId);
|
||||
$pickups[] = [
|
||||
'busProId' => $pickup->getBusProId(),
|
||||
'city' => $pickup->getCity(),
|
||||
'street' => $pickup->getStreet(),
|
||||
'time' => $pickup->getTime(),
|
||||
];
|
||||
}
|
||||
|
||||
return $pickups;
|
||||
}
|
||||
|
||||
private function updateEntity(Destination $destination, DestinationDto $destinationDto): void
|
||||
{
|
||||
$hotel = $this->hotelDataProvider->get($destinationDto->getHotelBusProId());
|
||||
$pickups = $this->mapPickups($destinationDto);
|
||||
|
||||
$destination
|
||||
->setProduct($destinationDto->getProduct())
|
||||
->setDateFrom($destinationDto->getDateFrom())
|
||||
->setDateTo($destinationDto->getDateTo())
|
||||
->setHotel($hotel->getName())
|
||||
->setHotelCode($hotel->getCode())
|
||||
->setHotelBusProId($hotel->getBusProId())
|
||||
->setPickups($pickups)
|
||||
;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user