fix(webservice): Polished code

This commit is contained in:
2026-03-05 09:37:45 +01:00
parent 29859178bd
commit 5511ebfe42
10 changed files with 55 additions and 41 deletions

View File

@@ -1,7 +1,7 @@
<?php
use Websmid\WsOrderReference\Entity\OrderReference;
use Websmid\WsOrderReference\Repository\OrderReferenceRepository;
use Websmid\OrderReference\Entity\OrderReference;
use Websmid\OrderReference\Repository\OrderReferenceRepository;
if (file_exists(__DIR__ . '../../vendor/autoload.php')) {
require_once __DIR__ . '../../vendor/autoload.php';
@@ -29,6 +29,7 @@ class ws_orderreferenceAjaxModuleFrontController extends ModuleFrontController
]));
return;
}
try {
/** @var \Doctrine\ORM\EntityManagerInterface $entityManager */
@@ -37,11 +38,11 @@ class ws_orderreferenceAjaxModuleFrontController extends ModuleFrontController
/** @var OrderReferenceRepository $repository */
$repository = $entityManager->getRepository(OrderReference::class);
$orderRef = $repository->findByCartId($idCart);
$orderRef = $repository->findByCartId((int)$idCart);
if (!$orderRef) {
$orderRef = new OrderReference();
$orderRef->setIdCart($idCart);
$orderRef->setIdCart((int)$idCart);
}
$orderRef->setOrderReference(pSQL($orderReference));