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))
$this->createNotFoundException();
// استفاده از متد ایمن برای پیدا کردن سند
$doc = $provider->findHesabdariDocSafely($entityManager, [
'code' => $params['code'],
'bid' => $request->headers->get('activeBid')
]);
// استفاده از query builder برای پیدا کردن سند
$doc = $entityManager->getRepository(HesabdariDoc::class)
->createQueryBuilder('h')
->where('h.code = :code')
->andWhere('h.bid = :bid')
->setParameter('code', $params['code'])
->setParameter('bid', $request->headers->get('activeBid'))
->getQuery()
->getOneOrNullResult();
if (!$doc)
throw $this->createNotFoundException();
$roll = '';