bug fix in remove documents

This commit is contained in:
Hesabix 2025-09-03 03:41:02 +03:30
parent 1cef78c6f5
commit 5893c5b196

View file

@ -685,11 +685,15 @@ class HesabdariController extends AbstractController
} }
if (!array_key_exists('code', $params)) if (!array_key_exists('code', $params))
$this->createNotFoundException(); $this->createNotFoundException();
// استفاده از متد ایمن برای پیدا کردن سند // استفاده از query builder برای پیدا کردن سند
$doc = $provider->findHesabdariDocSafely($entityManager, [ $doc = $entityManager->getRepository(HesabdariDoc::class)
'code' => $params['code'], ->createQueryBuilder('h')
'bid' => $request->headers->get('activeBid') ->where('h.code = :code')
]); ->andWhere('h.bid = :bid')
->setParameter('code', $params['code'])
->setParameter('bid', $request->headers->get('activeBid'))
->getQuery()
->getOneOrNullResult();
if (!$doc) if (!$doc)
throw $this->createNotFoundException(); throw $this->createNotFoundException();
$roll = ''; $roll = '';