feat: implement specialty hierarchy handling in doctor and representation APIs, add backfill command and tests
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user