function bindDoctorPracticeEntityArray($doctorPracticeEntitys) { $doctorPracticeDtos = new DoctorPracticeListDto(); $doctorPracticeDtoArray = array(); foreach ($doctorPracticeEntitys as $doctorPracticeEntity => $value) { array_push($doctorPracticeDtoArray, bindDoctorPracticeEntity($value)); } $doctorPracticeDtos->setDoctorPractices($doctorPracticeDtoArray); return $doctorPracticeDtos; }
$doctorPracticesArray = array(); foreach ($doctorPracticeListDto->getDoctorPractices() as $doctorPracticeDto) { $doctorPracticeEntity = bindDoctorPracticeDto($doctorPracticeDto); $entityManager->persist($doctorPracticeEntity); $entityManager->flush(); array_push($doctorPracticesArray, bindDoctorPracticeEntity($doctorPracticeEntity)); } $doctorPracticeListDto = new DoctorPracticeListDto(); $doctorPracticeListDto->setDoctorPractices($doctorPracticesArray); $doctorPracticeListDto->printData($app); }); $app->put('/doctorpractices/:id', function ($id) use($app) { global $entityManager; $doctorPracticeEntity = $entityManager->find("DoctorPracticeEntity", $id); $entityManager->flush(); $doctorPracticeDto = bindDoctorPracticeEntity($doctorPracticeEntity); $doctorPracticeDto->printData($app); }); $app->delete('/doctorpractices/:id', function ($id) use($app) { global $entityManager; $doctorPracticeEntity = $entityManager->find("DoctorPracticeEntity", $id); $entityManager->remove($doctorPracticeEntity); $entityManager->flush(); }); /*Referances*/ function getdoctorPracticeQueryArray($app) { $queryArray = array(); $medsDoctorPracticeId = $app->request()->get('medsDoctorPracticeId'); if ($medsDoctorPracticeId != null) { $queryArray['medsDoctorPracticeId'] = $medsDoctorPracticeId;