feat: refactoring of xml parsers
This commit is contained in:
@@ -9,6 +9,7 @@ use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
use function Symfony\Component\String\u;
|
||||
@@ -60,7 +61,9 @@ class DownloadController extends AbstractController
|
||||
|
||||
$filename = u($file->filename)->ascii();
|
||||
|
||||
$response = new Response($file->content);
|
||||
$response = new StreamedResponse(function () use ($file) {
|
||||
echo $file->content;
|
||||
});
|
||||
|
||||
$disposition = $response->headers->makeDisposition(
|
||||
ResponseHeaderBag::DISPOSITION_ATTACHMENT,
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Controller\Booking;
|
||||
|
||||
use App\BusProNet\ApiClient;
|
||||
use App\BusProNet\XmlLoader\PickupXmlLoader;
|
||||
use App\BusProNet\XmlLoader\TravelXmlLoader;
|
||||
use App\BusProNet\XmlLoader\PickupLoader;
|
||||
use App\BusProNet\XmlLoader\TravelLoader;
|
||||
use App\Form\BookingType;
|
||||
use App\Form\Model\BookingData;
|
||||
use Psr\Cache\InvalidArgumentException;
|
||||
@@ -20,11 +20,11 @@ use Symfony\Contracts\Cache\ItemInterface;
|
||||
class EditController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ApiClient $apiClient,
|
||||
private readonly TravelXmlLoader $travelDataLoader,
|
||||
private readonly PickupXmlLoader $pickupDataLoader,
|
||||
private readonly ApiClient $apiClient,
|
||||
private readonly TravelLoader $travelDataLoader,
|
||||
private readonly PickupLoader $pickupDataLoader,
|
||||
private readonly CacheInterface $cache,
|
||||
private readonly Security $security,
|
||||
private readonly Security $security,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ class EditController extends AbstractController
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->apiClient->updateBooking($formData, false);
|
||||
$this->apiClient->updateBooking($formData);
|
||||
|
||||
try {
|
||||
$this->cache->delete($cacheKeySingle);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Controller\Booking;
|
||||
|
||||
use App\BusProNet\ApiClient;
|
||||
use App\BusProNet\XmlLoader\TravelXmlLoader;
|
||||
use App\BusProNet\XmlLoader\TravelLoader;
|
||||
use Psr\Cache\InvalidArgumentException;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
@@ -17,10 +17,10 @@ use Symfony\Contracts\Cache\ItemInterface;
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ApiClient $apiClient,
|
||||
private readonly TravelXmlLoader $travelDataLoader,
|
||||
private readonly ApiClient $apiClient,
|
||||
private readonly TravelLoader $travelDataLoader,
|
||||
private readonly CacheInterface $cache,
|
||||
private readonly Security $security,
|
||||
private readonly Security $security,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user