feat: implement specialty hierarchy handling in doctor and representation APIs, add backfill command and tests

This commit is contained in:
hamed
2026-07-19 17:30:46 +03:30
parent 21b67ec075
commit 6496ebf336
12 changed files with 539 additions and 12 deletions
+6 -1
View File
@@ -112,7 +112,12 @@ class DoctorImportService
if (array_key_exists('info', $data)) $doctor->setInfo($data['info']);
// روابط بر پایهٔ شناسه‌های مرجع (تخصص/استان/شهر)
$this->syncRefCollection($doctor->getSpecialties(), $data['specialties'] ?? null, Specialty::class);
$specialtyIds = $data['specialties'] ?? null;
if (is_array($specialtyIds)) {
$specialtyIds = $this->em->getRepository(Specialty::class)
->expandWithAncestors(array_map('intval', $specialtyIds));
}
$this->syncRefCollection($doctor->getSpecialties(), $specialtyIds, Specialty::class);
$this->syncRefCollection($doctor->getProvinces(), $data['states'] ?? null, Province::class);
$this->syncRefCollection($doctor->getCities(), $data['cities'] ?? null, City::class);