fix: adjust active doctor appointment filter to default to true unless specified

This commit is contained in:
hamed
2026-06-21 18:02:03 +03:30
parent 21b6c583c0
commit 447ffc8862
+5 -4
View File
@@ -81,10 +81,11 @@ class DoctorRepository extends ServiceEntityRepository
if (!empty($filters['name'])) { if (!empty($filters['name'])) {
$qb->andWhere('d.name LIKE :name')->setParameter('name', '%' . $filters['name'] . '%'); $qb->andWhere('d.name LIKE :name')->setParameter('name', '%' . $filters['name'] . '%');
} }
if (isset($filters['active'])) { // Public list shows only doctors with appointment enabled unless the
$qb->andWhere('d.activeDoctorAppointment = :active') // caller explicitly asks otherwise (e.g. admin passing active=0).
->setParameter('active', (bool) $filters['active']); $active = isset($filters['active']) ? (bool) $filters['active'] : true;
} $qb->andWhere('d.activeDoctorAppointment = :active')
->setParameter('active', $active);
$qb->orderBy('d.doctorRate', $sort); $qb->orderBy('d.doctorRate', $sort);