diff --git a/src/Doctor/Repository/DoctorRepository.php b/src/Doctor/Repository/DoctorRepository.php index 94fdcad2..97b1b47f 100644 --- a/src/Doctor/Repository/DoctorRepository.php +++ b/src/Doctor/Repository/DoctorRepository.php @@ -81,10 +81,11 @@ class DoctorRepository extends ServiceEntityRepository if (!empty($filters['name'])) { $qb->andWhere('d.name LIKE :name')->setParameter('name', '%' . $filters['name'] . '%'); } - if (isset($filters['active'])) { - $qb->andWhere('d.activeDoctorAppointment = :active') - ->setParameter('active', (bool) $filters['active']); - } + // Public list shows only doctors with appointment enabled unless the + // caller explicitly asks otherwise (e.g. admin passing active=0). + $active = isset($filters['active']) ? (bool) $filters['active'] : true; + $qb->andWhere('d.activeDoctorAppointment = :active') + ->setParameter('active', $active); $qb->orderBy('d.doctorRate', $sort);